/* Generated by Cython 3.2.4 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [],
        "extra_compile_args": [
            "-fno-strict-overflow",
            "-Wsign-compare",
            "-DNDEBUG",
            "-g",
            "-O3",
            "-Wall",
            "-march=x86-64",
            "-mtune=generic",
            "-O3",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/python/src=/usr/src/debug/python",
            "-flto=auto",
            "-ffat-lto-objects",
            "-march=x86-64",
            "-mtune=generic",
            "-O3",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/python/src=/usr/src/debug/python",
            "-flto=auto",
            "-march=x86-64",
            "-mtune=generic",
            "-O3",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/python/src=/usr/src/debug/python",
            "-flto=auto",
            "-Wall",
            "-Wno-deprecated-declarations",
            "-fPIC",
            "-march=x86-64",
            "-mtune=generic",
            "-O2",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/xpra/src=/usr/src/debug/xpra",
            "-flto=auto"
        ],
        "extra_link_args": [
            "-Wall",
            "-Wl,-O1",
            "-Wl,--sort-common",
            "-Wl,--as-needed",
            "-Wl,-z,relro",
            "-Wl,-z,now",
            "-Wl,-z,pack-relative-relocs",
            "-flto=auto"
        ],
        "libraries": [
            "Xrandr"
        ],
        "name": "xpra.x11.bindings.randr",
        "sources": [
            "xpra/x11/bindings/randr.pyx"
        ]
    },
    "module_name": "xpra.x11.bindings.randr"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API)
  #if !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
  #endif
#elif defined(CYTHON_LIMITED_API)
  #ifdef _MSC_VER
  #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  #else
  #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  #endif
#endif

#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_2_4"
#define CYTHON_HEX_VERSION 0x030204F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #ifndef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 1
  #endif
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
  #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
    #undef CYTHON_IMMORTAL_CONSTANTS
    #define CYTHON_IMMORTAL_CONSTANTS 0  // definitely won't work
  #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
    #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_COMPRESS_STRINGS
  #define CYTHON_COMPRESS_STRINGS 1
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL)
#endif
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#include <stdint.h>
typedef uintptr_t  __pyx_uintptr_t;
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#ifndef Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CInitCode */
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef Py_TPFLAGS_IMMUTABLETYPE
  #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#endif
#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef METH_FASTCALL
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((int)PyUnicode_KIND(u))
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#elif CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
enum __Pyx_ReferenceSharing {
  __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  __Pyx_ReferenceSharing_OwnStrongReference,
  __Pyx_ReferenceSharing_FunctionArgument,
  __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
};
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
    (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
      (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
      (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
#else
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
#endif
#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  #endif
#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
    __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
#else
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__xpra__x11__bindings__randr
#define __PYX_HAVE_API__xpra__x11__bindings__randr
/* Early includes */
#include "X11/X.h"
#include "X11/Xutil.h"
#include "X11/Xlib.h"
#include <string.h>
#include <stdint.h>
#include "X11/extensions/randr.h"
#include "X11/extensions/render.h"
#include "X11/extensions/Xrandr.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifdef CYTHON_FREETHREADING_COMPATIBLE
#if CYTHON_FREETHREADING_COMPATIBLE
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
/* PretendToInitialize */
#ifdef __cplusplus
#if __cplusplus > 201103L
#include <type_traits>
#endif
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * const __pyx_cfilenm = __FILE__;
static const char *__pyx_filename;

/* #### Code section: filename_table ### */

static const char* const __pyx_f[] = {
  "xpra/x11/bindings/randr.pyx",
};
/* #### Code section: utility_code_proto_before_types ### */
/* Atomics.proto (used by UnpackUnboundCMethod) */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_nonatomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #define __pyx_nonatomic_ptr_type void*
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif

/* IncludeStructmemberH.proto (used by FixUpExtensionType) */
#include <structmember.h>

/* CriticalSectionsDefinition.proto (used by CriticalSections) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_End(cs)
#define __Pyx_PyCriticalSection2_End(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_End PyCriticalSection_End
#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
#endif

/* CriticalSections.proto (used by CythonFunctionShared) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
#else
#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#endif

/* #### Code section: numeric_typedefs ### */

/* "xpra/x11/bindings/xlib.pxd":10
 * 
 * 
 * ctypedef unsigned char BYTE             # <<<<<<<<<<<<<<
 * ctypedef unsigned char CARD8
 * ctypedef unsigned short CARD16
*/
typedef unsigned char __pyx_t_4xpra_3x11_8bindings_4xlib_BYTE;

/* "xpra/x11/bindings/xlib.pxd":11
 * 
 * ctypedef unsigned char BYTE
 * ctypedef unsigned char CARD8             # <<<<<<<<<<<<<<
 * ctypedef unsigned short CARD16
 * ctypedef unsigned long CARD32
*/
typedef unsigned char __pyx_t_4xpra_3x11_8bindings_4xlib_CARD8;

/* "xpra/x11/bindings/xlib.pxd":12
 * ctypedef unsigned char BYTE
 * ctypedef unsigned char CARD8
 * ctypedef unsigned short CARD16             # <<<<<<<<<<<<<<
 * ctypedef unsigned long CARD32
 * ctypedef unsigned long CARD64
*/
typedef unsigned short __pyx_t_4xpra_3x11_8bindings_4xlib_CARD16;

/* "xpra/x11/bindings/xlib.pxd":13
 * ctypedef unsigned char CARD8
 * ctypedef unsigned short CARD16
 * ctypedef unsigned long CARD32             # <<<<<<<<<<<<<<
 * ctypedef unsigned long CARD64
 * ctypedef int BOOL
*/
typedef unsigned long __pyx_t_4xpra_3x11_8bindings_4xlib_CARD32;

/* "xpra/x11/bindings/xlib.pxd":14
 * ctypedef unsigned short CARD16
 * ctypedef unsigned long CARD32
 * ctypedef unsigned long CARD64             # <<<<<<<<<<<<<<
 * ctypedef int BOOL
 * ctypedef int Bool
*/
typedef unsigned long __pyx_t_4xpra_3x11_8bindings_4xlib_CARD64;

/* "xpra/x11/bindings/xlib.pxd":15
 * ctypedef unsigned long CARD32
 * ctypedef unsigned long CARD64
 * ctypedef int BOOL             # <<<<<<<<<<<<<<
 * ctypedef int Bool
 * ctypedef int Status
*/
typedef int __pyx_t_4xpra_3x11_8bindings_4xlib_BOOL;

/* "xpra/x11/bindings/xlib.pxd":16
 * ctypedef unsigned long CARD64
 * ctypedef int BOOL
 * ctypedef int Bool             # <<<<<<<<<<<<<<
 * ctypedef int Status
 * ctypedef CARD32 Atom
*/
typedef int __pyx_t_4xpra_3x11_8bindings_4xlib_Bool;

/* "xpra/x11/bindings/xlib.pxd":17
 * ctypedef int BOOL
 * ctypedef int Bool
 * ctypedef int Status             # <<<<<<<<<<<<<<
 * ctypedef CARD32 Atom
 * ctypedef CARD32 XID
*/
typedef int __pyx_t_4xpra_3x11_8bindings_4xlib_Status;

/* "xpra/x11/bindings/xlib.pxd":18
 * ctypedef int Bool
 * ctypedef int Status
 * ctypedef CARD32 Atom             # <<<<<<<<<<<<<<
 * ctypedef CARD32 XID
 * ctypedef char* XPointer
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_CARD32 __pyx_t_4xpra_3x11_8bindings_4xlib_Atom;

/* "xpra/x11/bindings/xlib.pxd":19
 * ctypedef int Status
 * ctypedef CARD32 Atom
 * ctypedef CARD32 XID             # <<<<<<<<<<<<<<
 * ctypedef char* XPointer
 * ctypedef XID Drawable
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_CARD32 __pyx_t_4xpra_3x11_8bindings_4xlib_XID;

/* "xpra/x11/bindings/xlib.pxd":21
 * ctypedef CARD32 XID
 * ctypedef char* XPointer
 * ctypedef XID Drawable             # <<<<<<<<<<<<<<
 * ctypedef XID Window
 * ctypedef XID Pixmap
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_XID __pyx_t_4xpra_3x11_8bindings_4xlib_Drawable;

/* "xpra/x11/bindings/xlib.pxd":22
 * ctypedef char* XPointer
 * ctypedef XID Drawable
 * ctypedef XID Window             # <<<<<<<<<<<<<<
 * ctypedef XID Pixmap
 * ctypedef XID Cursor
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_XID __pyx_t_4xpra_3x11_8bindings_4xlib_Window;

/* "xpra/x11/bindings/xlib.pxd":23
 * ctypedef XID Drawable
 * ctypedef XID Window
 * ctypedef XID Pixmap             # <<<<<<<<<<<<<<
 * ctypedef XID Cursor
 * ctypedef CARD32 Colormap
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_XID __pyx_t_4xpra_3x11_8bindings_4xlib_Pixmap;

/* "xpra/x11/bindings/xlib.pxd":24
 * ctypedef XID Window
 * ctypedef XID Pixmap
 * ctypedef XID Cursor             # <<<<<<<<<<<<<<
 * ctypedef CARD32 Colormap
 * ctypedef CARD32 VisualID
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_XID __pyx_t_4xpra_3x11_8bindings_4xlib_Cursor;

/* "xpra/x11/bindings/xlib.pxd":25
 * ctypedef XID Pixmap
 * ctypedef XID Cursor
 * ctypedef CARD32 Colormap             # <<<<<<<<<<<<<<
 * ctypedef CARD32 VisualID
 * ctypedef CARD32 Time
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_CARD32 __pyx_t_4xpra_3x11_8bindings_4xlib_Colormap;

/* "xpra/x11/bindings/xlib.pxd":26
 * ctypedef XID Cursor
 * ctypedef CARD32 Colormap
 * ctypedef CARD32 VisualID             # <<<<<<<<<<<<<<
 * ctypedef CARD32 Time
 * ctypedef XID KeySym
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_CARD32 __pyx_t_4xpra_3x11_8bindings_4xlib_VisualID;

/* "xpra/x11/bindings/xlib.pxd":27
 * ctypedef CARD32 Colormap
 * ctypedef CARD32 VisualID
 * ctypedef CARD32 Time             # <<<<<<<<<<<<<<
 * ctypedef XID KeySym
 * 
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_CARD32 __pyx_t_4xpra_3x11_8bindings_4xlib_Time;

/* "xpra/x11/bindings/xlib.pxd":28
 * ctypedef CARD32 VisualID
 * ctypedef CARD32 Time
 * ctypedef XID KeySym             # <<<<<<<<<<<<<<
 * 
 * 
*/
typedef __pyx_t_4xpra_3x11_8bindings_4xlib_XID __pyx_t_4xpra_3x11_8bindings_4xlib_KeySym;

/* "xpra/x11/bindings/randr.pyx":41
 * 
 * from libc.stdint cimport uintptr_t   # pylint: disable=syntax-error
 * ctypedef unsigned long CARD32             # <<<<<<<<<<<<<<
 * ctypedef unsigned short SizeID
 * 
*/
typedef unsigned long __pyx_t_4xpra_3x11_8bindings_5randr_CARD32;

/* "xpra/x11/bindings/randr.pyx":42
 * from libc.stdint cimport uintptr_t   # pylint: disable=syntax-error
 * ctypedef unsigned long CARD32
 * ctypedef unsigned short SizeID             # <<<<<<<<<<<<<<
 * 
 * 
*/
typedef unsigned short __pyx_t_4xpra_3x11_8bindings_5randr_SizeID;
/* #### Code section: complex_type_declarations ### */
/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance;
struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr;
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr;

/* "xpra/x11/bindings/xlib.pxd":20
 * ctypedef CARD32 Atom
 * ctypedef CARD32 XID
 * ctypedef char* XPointer             # <<<<<<<<<<<<<<
 * ctypedef XID Drawable
 * ctypedef XID Window
*/
typedef char *__pyx_t_4xpra_3x11_8bindings_4xlib_XPointer;

/* "xpra/x11/bindings/events.pxd":12
 * cdef void add_event_type(int event, str name, str event_name, str child_event_name) noexcept
 * 
 * ctypedef dict (*PARSE_XEVENT)(Display* display, XEvent *event)             # <<<<<<<<<<<<<<
 * 
 * cdef str atom_str(Display *display, Atom atom)
*/
typedef PyObject *(*__pyx_t_4xpra_3x11_8bindings_6events_PARSE_XEVENT)(Display *, XEvent *);

/* "xpra/x11/bindings/core.pxd":9
 * from xpra.x11.bindings.xlib cimport Display, Atom
 * 
 * cdef class X11CoreBindingsInstance:             # <<<<<<<<<<<<<<
 *     cdef Display * display
 *     cdef object display_name
*/
struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance {
  PyObject_HEAD
  struct __pyx_vtabstruct_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *__pyx_vtab;
  Display *display;
  PyObject *display_name;
};


/* "xpra/x11/bindings/randr.pyx":603
 * 
 * 
 * cdef class RandRBindingsInstance(X11CoreBindingsInstance):             # <<<<<<<<<<<<<<
 * 
 *     cdef int _has_randr
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance {
  struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance __pyx_base;
  int _has_randr;
  int event_base;
  PyObject *_added_modes;
  PyObject *version;
};


/* "xpra/x11/bindings/randr.pyx":328
 * 
 * 
 * cdef dict get_mode_info(XRRModeInfo *mi, with_sync: bool):             # <<<<<<<<<<<<<<
 *     info = {
 *         "id"            : mi.id,
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info {
  PyObject_HEAD
  XRRModeInfo *__pyx_v_mi;
};


/* "xpra/x11/bindings/randr.pyx":346
 *             "v-sync-end"    : mi.vSyncEnd,
 *             "v-total"       : mi.vTotal,
 *             "mode-flags"    : tuple(name for v,name in MODE_FLAGS_STR.items() if mi.modeFlags & v),             # <<<<<<<<<<<<<<
 *         }
 *     return info
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
};


/* "xpra/x11/bindings/randr.pyx":351
 * 
 * 
 * cdef dict get_output_info(Display *display, XRRScreenResources *rsc, RROutput output):             # <<<<<<<<<<<<<<
 *     cdef XRROutputInfo *oi = XRRGetOutputInfo(display, rsc, output)
 *     if oi==NULL:
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info {
  PyObject_HEAD
  XRROutputInfo *__pyx_v_oi;
};


/* "xpra/x11/bindings/randr.pyx":371
 *             info["subpixel-order"] = so
 *         if oi.nclone:
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))             # <<<<<<<<<<<<<<
 *         info["properties"] = get_output_properties(display, output)
 *     if oi.name and oi.nameLen:
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info *__pyx_outer_scope;
  int __pyx_genexpr_arg_0;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "xpra/x11/bindings/randr.pyx":396
 * 
 * 
 * cdef dict get_output_properties(Display *display, RROutput output):             # <<<<<<<<<<<<<<
 *     cdef int nprop
 *     cdef Atom *atoms = XRRListOutputProperties(display, output, &nprop)
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties {
  PyObject_HEAD
  Display *__pyx_v_display;
};


/* "xpra/x11/bindings/randr.pyx":448
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)
 *             if at=="ATOM":
 *                 value = tuple(get_XAtom(display, v) for v in value)             # <<<<<<<<<<<<<<
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:
 *                 #EDID is a binary blob:
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "xpra/x11/bindings/randr.pyx":509
 * 
 * 
 * cdef dict get_crtc_info(Display *display, XRRScreenResources *rsc, RRCrtc crtc):             # <<<<<<<<<<<<<<
 *     cdef XRRCrtcInfo *ci = XRRGetCrtcInfo(display, rsc, crtc)
 *     if ci==NULL:
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info {
  PyObject_HEAD
  XRRCrtcInfo *__pyx_v_ci;
  XRRCrtcGamma *__pyx_v_gamma;
};


/* "xpra/x11/bindings/randr.pyx":518
 *     }
 *     if ci.noutput:
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))             # <<<<<<<<<<<<<<
 *     if TIMESTAMPS:
 *         info["timestamp"] = int(ci.timestamp)
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *__pyx_outer_scope;
  int __pyx_genexpr_arg_0;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "xpra/x11/bindings/randr.pyx":534
 *             if gamma and gamma.size:
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *__pyx_outer_scope;
  int __pyx_genexpr_arg_0;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "xpra/x11/bindings/randr.pyx":535
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),
 *                 }
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *__pyx_outer_scope;
  int __pyx_genexpr_arg_0;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "xpra/x11/bindings/randr.pyx":536
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                 }
 *                 XRRFreeGamma(gamma)
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *__pyx_outer_scope;
  int __pyx_genexpr_arg_0;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "xpra/x11/bindings/randr.pyx":562
 * 
 * 
 * cdef object _monitor_properties(Display *display, XRRMonitorInfo *m):             # <<<<<<<<<<<<<<
 *     return {
 *         "name"      : get_XAtom(display, m.name),
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties {
  PyObject_HEAD
  XRRMonitorInfo *__pyx_v_m;
};


/* "xpra/x11/bindings/randr.pyx":574
 *         "height-mm" : m.mheight,
 *         #"outputs"   : tuple(rroutput_map.get(m.outputs[j], 0) for j in range(m.noutput)),
 *         "outputs"   : tuple(m.outputs[j] for j in range(m.noutput)),             # <<<<<<<<<<<<<<
 *     }
 * 
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties *__pyx_outer_scope;
  int __pyx_genexpr_arg_0;
  int __pyx_v_j;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "xpra/x11/bindings/randr.pyx":713
 *                     log.error(f" {num_sizes} sizes are supported")
 *                     if num_sizes<=16:
 *                         log.error(" %s", csv(f"{w}x{h}" for w, h in sizes))             # <<<<<<<<<<<<<<
 *                     else:
 *                         log(f"sizes found: {csv(sizes)}")
*/
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_h;
  PyObject *__pyx_v_w;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};



/* "xpra/x11/bindings/core.pxd":9
 * from xpra.x11.bindings.xlib cimport Display, Atom
 * 
 * cdef class X11CoreBindingsInstance:             # <<<<<<<<<<<<<<
 *     cdef Display * display
 *     cdef object display_name
*/

struct __pyx_vtabstruct_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom (*xatom)(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *, PyObject *);
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom (*str_to_atom)(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *, PyObject *);
};
static struct __pyx_vtabstruct_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *__pyx_vtabptr_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance;


/* "xpra/x11/bindings/randr.pyx":603
 * 
 * 
 * cdef class RandRBindingsInstance(X11CoreBindingsInstance):             # <<<<<<<<<<<<<<
 * 
 *     cdef int _has_randr
*/

struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance {
  struct __pyx_vtabstruct_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance __pyx_base;
  PyObject *(*_get_xrr_screen_sizes)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *);
  int (*_set_screen_size)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *, PyObject *, PyObject *);
  RRMode (*add_screen_mode)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *, PyObject *, unsigned int, unsigned int, double);
  XRRModeInfo *(*calculate_mode)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *, PyObject *, unsigned int, unsigned int, double);
  RROutput (*get_current_output)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *);
};
static struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_vtabptr_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_XINCREF(r)  do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyThreadStateGet.proto (used by PyErrFetchRestore) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* TupleAndListFromArray.proto (used by fastcall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#endif
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* IncludeStringH.proto (used by BytesEquals) */
#include <string.h>

/* BytesEquals.proto (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* PyDictVersioning.proto (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyObjectCall.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectFastCall.proto */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);

/* pyint_simplify.proto */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none);

/* IterFinish.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

/* PyObjectCallOneArg.proto (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
#endif

/* PyObjectCallMethod0.proto (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNeedMoreValuesToUnpack.proto (used by UnpackTuple2) */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseTooManyValuesToUnpack.proto (used by UnpackItemEndCheck) */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* UnpackItemEndCheck.proto (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* RaiseNoneIterError.proto (used by UnpackTupleError) */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
    PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple);
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* RaiseUnboundLocalError.proto */
static void __Pyx_RaiseUnboundLocalError(const char *varname);

/* GetException.proto (used by pep479) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* pep479.proto */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);

/* decode_c_string_utf16.proto (used by decode_c_bytes) */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_bytes.proto (used by decode_bytes) */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* decode_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
         PyObject* string, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    char* as_c_string;
    Py_ssize_t size;
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    as_c_string = PyBytes_AS_STRING(string);
    size = PyBytes_GET_SIZE(string);
#else
    if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) {
        return NULL;
    }
#endif
    return __Pyx_decode_c_bytes(
        as_c_string, size,
        start, stop, encoding, errors, decode_func);
}

/* GetTopmostException.proto (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyObject_Unicode.proto */
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))

/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

/* GCCDiagnostics.proto (used by CIntToPyUnicode) */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* IncludeStdlibH.proto (used by CIntToPyUnicode) */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_RROutput(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_RROutput(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_RROutput(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_RROutput(RROutput value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_RROutput(RROutput value, Py_ssize_t width, char padding_char, char format_char);

/* JoinPyUnicode */
static PyObject*(*__Pyx_PyUnicode_Join)(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); /*proto*/

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* PyValueError_Check.proto */
#define __Pyx_PyExc_ValueError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ValueError)

/* RaiseException */
static void(*__Pyx_Raise)(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/

/* PySequenceMultiply.proto */
#define __Pyx_PySequence_Multiply_Left(mul, seq)  __Pyx_PySequence_Multiply(seq, mul)
#if !CYTHON_USE_TYPE_SLOTS
#define  __Pyx_PySequence_Multiply PySequence_Repeat
#else
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul);
#endif

/* ImportImpl */
static PyObject *(*__Pyx__Import)(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); /*proto*/

/* Import.proto */
static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

/* PyImportError_Check.proto */
#define __Pyx_PyExc_ImportError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ImportError)

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* PyObjectVectorCallKwBuilder.proto */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* dict_setdefault.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* DictGetItem.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* ArgTypeTestFunc */
static int(*__Pyx__ArgTypeTest)(PyObject *obj, PyTypeObject *type, const char *name, int exact); /*proto*/

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RejectKeywords */
static void(*__Pyx_RejectKeywords)(const char* function_name, PyObject *kwds); /*proto*/

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* py_dict_keys.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);

/* CallCFunction.proto (used by CallUnboundCMethod0) */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod0.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethod1.proto (used by append) */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* PyRuntimeError_Check.proto */
#define __Pyx_PyExc_RuntimeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_RuntimeError)

/* ParseKeywordsImpl */
static int(*__Pyx_ParseKeywordsTuple)(PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs); /*proto*/
static int(*__Pyx_ParseKeywordDictToDict)(PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
static int(*__Pyx_ParseKeywordDict)(PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs); /*proto*/

/* ParseKeywords.proto */
static CYTHON_INLINE int __Pyx_ParseKeywords(
    PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
    PyObject *kwds2, PyObject *values[],
    Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* CallUnboundCMethod1.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_unsigned_int(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_unsigned_int(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_unsigned_int(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char, char format_char);

/* PyObjectFormat.proto */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
#else
#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
#endif

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_LIMITED_API  ||  PY_VERSION_HEX >= 0x030C0000
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  #if __clang__ || __GNUC__
  __attribute__((no_sanitize("thread")))
  #endif
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

/* PyAssertionError_Check.proto */
#define __Pyx_PyExc_AssertionError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AssertionError)

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_RRMode(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_RRMode(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_RRMode(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_RRMode(RRMode value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_RRMode(RRMode value, Py_ssize_t width, char padding_char, char format_char);

/* UnicodeConcatInPlace.proto */
# if CYTHON_COMPILING_IN_CPYTHON
    #if CYTHON_REFNANNY
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared, __pyx_refnanny)
    #else
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared)
    #endif
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_OwnStrongReference)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_SharedReference)
    static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    );
#else
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace __Pyx_PyUnicode_Concat
#endif
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right))

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* FixUpExtensionType.proto (used by FetchCommonType) */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* AddModuleRef.proto (used by FetchSharedCythonModule) */
#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
     __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
#else
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#endif

/* FetchSharedCythonModule.proto (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* FetchCommonType.proto (used by CommonTypesMetaclass) */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */
static int __pyx_CommonTypesMetaclass_init(PyObject *module);
#define __Pyx_CommonTypesMetaclass_USED

/* CallTypeTraverse.proto (used by CythonFunctionShared) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* PyMethodNew.proto (used by CythonFunctionShared) */
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);

/* py_dict_items.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* py_dict_values.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* OwnedDictNext.proto (used by PyVectorcallFastCallDict) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
#else
CYTHON_INLINE
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
#endif

/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
#endif

/* CythonFunctionShared.proto (used by CythonFunction) */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_dict;
#endif
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    PyObject *defaults;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
                                                         PyTypeObject *defaults_type);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

/* PyRange_Check.proto */
#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  #define PyRange_Check(obj)  __Pyx_TypeCheck((obj), &PyRange_Type)
#endif

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* CallUnboundCMethod2.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_RRCrtc(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_RRCrtc(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_RRCrtc(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_RRCrtc(RRCrtc value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_RRCrtc(RRCrtc value, Py_ssize_t width, char padding_char, char format_char);

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyUnicode_Substring.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop);

/* CallNextTpDealloc.proto */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);

/* CallNextTpTraverse.proto */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);

/* CallNextTpClear.proto */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear);

/* CheckTypeForFreelists.proto */
#if CYTHON_USE_FREELISTS
#if CYTHON_USE_TYPE_SPECS
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  Py_TPFLAGS_IS_ABSTRACT
#else
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
#endif
#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
    (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
     (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
#endif

/* AllocateExtensionType.proto */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig);

/* GetApiDict.proto */
static PyObject *__Pyx_ApiExport_GetApiDict(void);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_4
#define __PYX_HAVE_RT_ImportType_proto_3_2_4
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_2_4 {
   __Pyx_ImportType_CheckSize_Error_3_2_4 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_2_4 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_2_4 = 2
};
static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* ValidateBasesTuple.proto (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* FunctionImport.proto */
static int __Pyx_ImportFunction_3_2_4(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

/* CLineInTraceback.proto (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto (used by AddTraceback) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_Rotation(Rotation value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_Connection(Connection value);

/* CIntFromPy.proto */
static CYTHON_INLINE Rotation __Pyx_PyLong_As_Rotation(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_int(unsigned int value);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned long __Pyx_PyLong_As_unsigned_long(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_long(unsigned long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_XRRModeFlags(XRRModeFlags value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_SubpixelOrder(SubpixelOrder value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_short(unsigned short value);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_short(short value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
    return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
}
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#ifdef PyExceptionInstance_Check
  #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
#else
  #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
#endif

/* GetRuntimeVersion.proto */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
static unsigned long __Pyx_cached_runtime_version = 0;
static void __Pyx_init_runtime_version(void);
#else
#define __Pyx_init_runtime_version()
#endif
static unsigned long __Pyx_get_runtime_version(void);

/* IterNextPlain.proto (used by CoroutineBase) */
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
#endif

/* ReturnWithStopIteration.proto (used by CoroutineBase) */
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);

/* CoroutineBase.proto (used by Generator) */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *gi_weakreflist;
#endif
    PyObject *classobj;
    PyObject *yieldfrom;
    __Pyx_pyiter_sendfunc yieldfrom_am_send;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
    uint64_t __pyx_pymonitoring_version;
#endif
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);

/* Generator.proto */
#define __Pyx_Generator_USED
#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(PyObject *module);
static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

/* DecompressString.proto */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance__get_xrr_screen_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto*/
static int __pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance__set_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height); /* proto*/
static RRMode __pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_add_screen_mode(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_name, unsigned int __pyx_v_w, unsigned int __pyx_v_h, double __pyx_v_hz); /* proto*/
static XRRModeInfo *__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_calculate_mode(CYTHON_UNUSED struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_name, unsigned int __pyx_v_w, unsigned int __pyx_v_h, double __pyx_v_vrefresh); /* proto*/
static RROutput __pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_get_current_output(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto*/

/* Module declarations from "xpra.x11.bindings.xlib" */

/* Module declarations from "libc.string" */

/* Module declarations from "xpra.x11.bindings.core" */
static void (*__pyx_f_4xpra_3x11_8bindings_4core_import_check)(PyObject *); /*proto*/

/* Module declarations from "xpra.x11.bindings.display_source" */
static Display *(*__pyx_f_4xpra_3x11_8bindings_14display_source_get_display)(void); /*proto*/

/* Module declarations from "xpra.x11.bindings.events" */
static void (*__pyx_f_4xpra_3x11_8bindings_6events_add_event_type)(int, PyObject *, PyObject *, PyObject *); /*proto*/
static void (*__pyx_f_4xpra_3x11_8bindings_6events_add_parser)(unsigned int, __pyx_t_4xpra_3x11_8bindings_6events_PARSE_XEVENT); /*proto*/

/* Module declarations from "libc.stdint" */

/* Module declarations from "xpra.x11.bindings.randr" */
static struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_4xpra_3x11_8bindings_5randr_singleton = 0;
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_all_screen_properties(Display *); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info(XRRModeInfo *, int); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_output_info(Display *, XRRScreenResources *, RROutput); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_XAtom(Display *, __pyx_t_4xpra_3x11_8bindings_4xlib_Atom); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_s(char const *); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties(Display *, RROutput); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info(Display *, XRRScreenResources *, RRCrtc); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_monitor_properties(Display *); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties(Display *, XRRMonitorInfo *); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_query_version(Display *); /*proto*/
static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_parse_ScreenChangeNotify(Display *, XEvent *); /*proto*/
/* #### Code section: typeinfo ### */
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "xpra.x11.bindings.randr"
extern int __pyx_module_is_main_xpra__x11__bindings__randr;
int __pyx_module_is_main_xpra__x11__bindings__randr = 0;

/* Implementation of "xpra.x11.bindings.randr" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_min;
static PyObject *__pyx_builtin_round;
static PyObject *__pyx_builtin_max;
/* #### Code section: string_decls ### */
/* #### Code section: decls ### */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_get_rotation(CYTHON_UNUSED PyObject *__pyx_self, Rotation __pyx_v_v); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_2get_rotations(CYTHON_UNUSED PyObject *__pyx_self, Rotation __pyx_v_v); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_mode_info_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_15get_output_info_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21get_output_properties_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_3genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_6genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_9genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_19_monitor_properties_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_4get_monitor_properties(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_display); /* proto */
static int __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance___init__(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_2__repr__(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_4get_version(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_6check_randr_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_8has_randr(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_10select_screen_changes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_12select_crtc_output_changes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_14get_xrr_screen_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16get_screen_count(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_18get_screen_size_mm(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_20get_screen_sizes_mm(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_22get_screen_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_24get_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_26get_screen_size_range(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_28get_vrefresh(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_30get_vrefresh_display(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_32get_vrefresh_outputs(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_34set_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, int __pyx_v_width, int __pyx_v_height); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_36add_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, unsigned int __pyx_v_w, unsigned int __pyx_v_h, unsigned int __pyx_v_vrefresh); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_38remove_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, unsigned int __pyx_v_w, unsigned int __pyx_v_h); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_40remove_mode(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, RRMode __pyx_v_mode); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_42xrr_set_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, int __pyx_v_w, int __pyx_v_h, int __pyx_v_wmm, int __pyx_v_hmm); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_44is_dummy16(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_46get_monitor_properties(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_48get_all_screen_properties(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_50set_output_int_property(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, int __pyx_v_output, PyObject *__pyx_v_prop_name, int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_52has_mode(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, unsigned int __pyx_v_w, unsigned int __pyx_v_h); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_54DeleteMonitor(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_56set_crtc_config(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_monitor_defs); /* proto */
static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_6init_xrandr_events(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_pf_4xpra_3x11_8bindings_5randr_8RandRBindings(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr_RandRBindingsInstance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr;
  PyObject *__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr;
  PyTypeObject *__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type__rstrip;
  unsigned int __pyx_k__7;
  PyObject *__pyx_tuple[14];
  PyObject *__pyx_codeobj_tab[42];
  PyObject *__pyx_string_tab[530];
  PyObject *__pyx_number_tab[17];
/* #### Code section: module_state_contents ### */
/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif

/* CythonFunctionShared.module_state_decls */
PyTypeObject *__pyx_CyFunctionType;


#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr[8];
int __pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr;
#endif
/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* IterNextPlain.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
#endif

/* Generator.module_state_decls */
PyTypeObject *__pyx_GeneratorType;

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_ __pyx_string_tab[0]
#define __pyx_kp_u_0 __pyx_string_tab[1]
#define __pyx_kp_u_DeleteMonitor_r __pyx_string_tab[2]
#define __pyx_kp_u_Dict_int_int __pyx_string_tab[3]
#define __pyx_kp_u_Dict_str_Any __pyx_string_tab[4]
#define __pyx_kp_u_Error_cannot_access_screen_resou __pyx_string_tab[5]
#define __pyx_kp_u_Error_cannot_get_refresh_rate_fr __pyx_string_tab[6]
#define __pyx_kp_u_Error_crtc __pyx_string_tab[7]
#define __pyx_kp_u_Error_failed_to_add_mode_r_to_ou __pyx_string_tab[8]
#define __pyx_kp_u_Error_failed_to_get_randr_config __pyx_string_tab[9]
#define __pyx_kp_u_Error_failed_to_get_randr_screen __pyx_string_tab[10]
#define __pyx_kp_u_Error_failed_to_get_randr_screen_2 __pyx_string_tab[11]
#define __pyx_kp_u_Error_failed_to_retrieve_the_lis __pyx_string_tab[12]
#define __pyx_kp_u_Error_failed_to_set_new_screen_s __pyx_string_tab[13]
#define __pyx_kp_u_Error_invalid_monitor_indexes_in __pyx_string_tab[14]
#define __pyx_kp_u_Error_only __pyx_string_tab[15]
#define __pyx_kp_u_Error_output __pyx_string_tab[16]
#define __pyx_kp_u_Error_size_not_found_for __pyx_string_tab[17]
#define __pyx_kp_u_Error_this_display_has_no_output __pyx_string_tab[18]
#define __pyx_kp_u_Error_unpacking __pyx_string_tab[19]
#define __pyx_kp_u_Hz_2 __pyx_string_tab[20]
#define __pyx_kp_u_Hz_is_above_maximum_value __pyx_string_tab[21]
#define __pyx_kp_u_L_2 __pyx_string_tab[22]
#define __pyx_kp_u_List_Tuple_int_int __pyx_string_tab[23]
#define __pyx_kp_u_List_int __pyx_string_tab[24]
#define __pyx_kp_u_Modeline_ix_i_s_s_s_s_s_s_s_s_s __pyx_string_tab[25]
#define __pyx_kp_u_None __pyx_string_tab[26]
#define __pyx_kp_u_RandRBindings __pyx_string_tab[27]
#define __pyx_kp_u_ScreenChangeNotify_d __pyx_string_tab[28]
#define __pyx_kp_u_Tuple_Tuple_int_int_Tuple_int_in __pyx_string_tab[29]
#define __pyx_kp_u_Tuple_int_int __pyx_string_tab[30]
#define __pyx_kp_u_Warning_XRandR_extension_is_not __pyx_string_tab[31]
#define __pyx_kp_u_Warning_XRandR_extension_returne __pyx_string_tab[32]
#define __pyx_kp_u_Warning_XRandR_version_check_fai __pyx_string_tab[33]
#define __pyx_kp_u_Warning_XRandR_version_s_does_no __pyx_string_tab[34]
#define __pyx_kp_u_Warning_cannot_add_mode __pyx_string_tab[35]
#define __pyx_kp_u_Warning_failed_to_read_output_pr __pyx_string_tab[36]
#define __pyx_kp_u_Warning_invalid_EDID_data __pyx_string_tab[37]
#define __pyx_kp_u_Warning_invalid_vertical_refresh __pyx_string_tab[38]
#define __pyx_kp_u_Warning_no_CRTC_info_for __pyx_string_tab[39]
#define __pyx_kp_u_Warning_no_randr_sizes_found __pyx_string_tab[40]
#define __pyx_kp_u_XRRCreateMode_returned __pyx_string_tab[41]
#define __pyx_kp_u_XRRSetCrtcConfig_x_x_i_i_i_i_i_i __pyx_string_tab[42]
#define __pyx_kp_u_XRRSetMonitor_x_x_x_output_i_geo __pyx_string_tab[43]
#define __pyx_kp_u_XRRSetScreenConfigAndRate_retur __pyx_string_tab[44]
#define __pyx_kp_u_XRRSetScreenConfigAndRate_s_s __pyx_string_tab[45]
#define __pyx_kp_u_XRRSetScreenSize_x_x_i_i_i_i __pyx_string_tab[46]
#define __pyx_kp_u__10 __pyx_string_tab[47]
#define __pyx_kp_u__11 __pyx_string_tab[48]
#define __pyx_kp_u__2 __pyx_string_tab[49]
#define __pyx_kp_u__3 __pyx_string_tab[50]
#define __pyx_kp_u__4 __pyx_string_tab[51]
#define __pyx_kp_u__5 __pyx_string_tab[52]
#define __pyx_kp_u__6 __pyx_string_tab[53]
#define __pyx_kp_u__8 __pyx_string_tab[54]
#define __pyx_kp_u__9 __pyx_string_tab[55]
#define __pyx_kp_u_active_names_s __pyx_string_tab[56]
#define __pyx_kp_u_add_screen_mode_s_i_i_i __pyx_string_tab[57]
#define __pyx_kp_u_added_modes_s __pyx_string_tab[58]
#define __pyx_kp_u_added_to_output __pyx_string_tab[59]
#define __pyx_kp_u_adding_mode __pyx_string_tab[60]
#define __pyx_kp_u_all_names_s __pyx_string_tab[61]
#define __pyx_kp_u_and_output __pyx_string_tab[62]
#define __pyx_kp_u_are_already_disabled __pyx_string_tab[63]
#define __pyx_kp_u_at_i_i __pyx_string_tab[64]
#define __pyx_kp_u_calculate_mode_s_i_i_f __pyx_string_tab[65]
#define __pyx_kp_u_calculating_mode_r __pyx_string_tab[66]
#define __pyx_kp_u_cannot_access_screen_resources __pyx_string_tab[67]
#define __pyx_kp_u_cannot_parse_EDID __pyx_string_tab[68]
#define __pyx_kp_u_cannot_set_screen_size_to_match __pyx_string_tab[69]
#define __pyx_kp_u_check_randr_sizes_failed_to_get __pyx_string_tab[70]
#define __pyx_kp_u_clock __pyx_string_tab[71]
#define __pyx_kp_u_config_timestamp __pyx_string_tab[72]
#define __pyx_kp_u_crtc __pyx_string_tab[73]
#define __pyx_kp_u_crtc_and_output __pyx_string_tab[74]
#define __pyx_kp_u_crtcs_2 __pyx_string_tab[75]
#define __pyx_kp_u_crtcs_for __pyx_string_tab[76]
#define __pyx_kp_u_data_too_large __pyx_string_tab[77]
#define __pyx_kp_u_delete_s __pyx_string_tab[78]
#define __pyx_kp_u_deleting_i_r __pyx_string_tab[79]
#define __pyx_kp_u_disable __pyx_string_tab[80]
#define __pyx_kp_u_disabling_dummy_crtc_and_output __pyx_string_tab[81]
#define __pyx_kp_u_dot_clock __pyx_string_tab[82]
#define __pyx_kp_u_dpi __pyx_string_tab[83]
#define __pyx_kp_u_enable __pyx_string_tab[84]
#define __pyx_kp_u_failed_to_remove_older_mode __pyx_string_tab[85]
#define __pyx_kp_u_failed_to_set_crtc_config_for_mo __pyx_string_tab[86]
#define __pyx_kp_u_for __pyx_string_tab[87]
#define __pyx_kp_u_for_mode_s __pyx_string_tab[88]
#define __pyx_kp_u_found __pyx_string_tab[89]
#define __pyx_kp_u_found_XRandR_extension_version __pyx_string_tab[90]
#define __pyx_kp_u_from __pyx_string_tab[91]
#define __pyx_kp_u_gc __pyx_string_tab[92]
#define __pyx_kp_u_get_current_output_screen_resour __pyx_string_tab[93]
#define __pyx_kp_u_get_monitor_properties_x __pyx_string_tab[94]
#define __pyx_kp_u_get_xrr_screen_sizes __pyx_string_tab[95]
#define __pyx_kp_u_h_skew __pyx_string_tab[96]
#define __pyx_kp_u_h_sync_end __pyx_string_tab[97]
#define __pyx_kp_u_h_sync_start __pyx_string_tab[98]
#define __pyx_kp_u_h_total __pyx_string_tab[99]
#define __pyx_kp_u_has __pyx_string_tab[100]
#define __pyx_kp_u_height_mm __pyx_string_tab[101]
#define __pyx_kp_u_i __pyx_string_tab[102]
#define __pyx_kp_u_invalid_format __pyx_string_tab[103]
#define __pyx_kp_u_invalid_format_2 __pyx_string_tab[104]
#define __pyx_kp_u_invalid_output_number __pyx_string_tab[105]
#define __pyx_kp_u_is __pyx_string_tab[106]
#define __pyx_kp_u_is_dummy16_monitor __pyx_string_tab[107]
#define __pyx_kp_u_is_dummy16_no_modes __pyx_string_tab[108]
#define __pyx_kp_u_is_dummy16_no_monitors __pyx_string_tab[109]
#define __pyx_kp_u_is_dummy16_no_randr __pyx_string_tab[110]
#define __pyx_kp_u_is_dummy16_only __pyx_string_tab[111]
#define __pyx_kp_u_is_dummy16_randr_version_too_old __pyx_string_tab[112]
#define __pyx_kp_u_isenabled __pyx_string_tab[113]
#define __pyx_kp_u_keeping_i_r __pyx_string_tab[114]
#define __pyx_kp_u_matching_monitor_index __pyx_string_tab[115]
#define __pyx_kp_u_mm __pyx_string_tab[116]
#define __pyx_kp_u_mode_2 __pyx_string_tab[117]
#define __pyx_kp_u_mode_flags __pyx_string_tab[118]
#define __pyx_kp_u_monitor __pyx_string_tab[119]
#define __pyx_kp_u_monitors_2 __pyx_string_tab[120]
#define __pyx_kp_u_monitors_s __pyx_string_tab[121]
#define __pyx_kp_u_no_XRandR __pyx_string_tab[122]
#define __pyx_kp_u_no_mode_to_match __pyx_string_tab[123]
#define __pyx_kp_u_no_randr_sizes __pyx_string_tab[124]
#define __pyx_kp_u_no_randr_sizes_2 __pyx_string_tab[125]
#define __pyx_kp_u_no_suitable_clocks_could_be_fou __pyx_string_tab[126]
#define __pyx_kp_u_non_desktop __pyx_string_tab[127]
#define __pyx_kp_u_not_found __pyx_string_tab[128]
#define __pyx_kp_u_not_found_2 __pyx_string_tab[129]
#define __pyx_kp_u_only __pyx_string_tab[130]
#define __pyx_kp_u_only_2 __pyx_string_tab[131]
#define __pyx_kp_u_output __pyx_string_tab[132]
#define __pyx_kp_u_outputs_2 __pyx_string_tab[133]
#define __pyx_kp_u_outputs_cannot_set __pyx_string_tab[134]
#define __pyx_kp_u_outputs_for __pyx_string_tab[135]
#define __pyx_kp_u_preferred_mode __pyx_string_tab[136]
#define __pyx_kp_u_primary_output __pyx_string_tab[137]
#define __pyx_kp_u_properties_from_output __pyx_string_tab[138]
#define __pyx_kp_u_reading __pyx_string_tab[139]
#define __pyx_kp_u_refresh_rate __pyx_string_tab[140]
#define __pyx_kp_u_refresh_rate_for __pyx_string_tab[141]
#define __pyx_kp_u_remove_mode_2 __pyx_string_tab[142]
#define __pyx_kp_u_reserved_names_s __pyx_string_tab[143]
#define __pyx_kp_u_root_size_is_now __pyx_string_tab[144]
#define __pyx_kp_u_s_2 __pyx_string_tab[145]
#define __pyx_kp_u_screen_sizes __pyx_string_tab[146]
#define __pyx_kp_u_screen_sizes_for_all_screens_in __pyx_string_tab[147]
#define __pyx_kp_u_set_crtc_config_2 __pyx_string_tab[148]
#define __pyx_kp_u_set_screen_size __pyx_string_tab[149]
#define __pyx_kp_u_setting_dummy_crtc_and_output __pyx_string_tab[150]
#define __pyx_kp_u_sizes_are_supported __pyx_string_tab[151]
#define __pyx_kp_u_sizes_found __pyx_string_tab[152]
#define __pyx_kp_u_skipped_output_property __pyx_string_tab[153]
#define __pyx_kp_u_status_s __pyx_string_tab[154]
#define __pyx_kp_u_subpixel_order __pyx_string_tab[155]
#define __pyx_kp_u_to __pyx_string_tab[156]
#define __pyx_kp_u_to_2 __pyx_string_tab[157]
#define __pyx_kp_u_to_output __pyx_string_tab[158]
#define __pyx_kp_u_too_many_new_modes_i_trying_to_r __pyx_string_tab[159]
#define __pyx_kp_u_total_screen_area_is __pyx_string_tab[160]
#define __pyx_kp_u_unable_to_query_screen_size_rang __pyx_string_tab[161]
#define __pyx_kp_u_using_existing_output_mode_r_x_f __pyx_string_tab[162]
#define __pyx_kp_u_using_format __pyx_string_tab[163]
#define __pyx_kp_u_using_name __pyx_string_tab[164]
#define __pyx_kp_u_using_screen_mode __pyx_string_tab[165]
#define __pyx_kp_u_v_sync_end __pyx_string_tab[166]
#define __pyx_kp_u_v_sync_start __pyx_string_tab[167]
#define __pyx_kp_u_v_total __pyx_string_tab[168]
#define __pyx_kp_u_version_s __pyx_string_tab[169]
#define __pyx_kp_u_width_mm __pyx_string_tab[170]
#define __pyx_kp_u_with_event_base __pyx_string_tab[171]
#define __pyx_kp_u_x11_screen_change_event __pyx_string_tab[172]
#define __pyx_kp_u_x_2 __pyx_string_tab[173]
#define __pyx_kp_u_xpra_x11_bindings_randr_pyx __pyx_string_tab[174]
#define __pyx_n_u_ABCDEFGHIJKLMNOPQRSTUVWXYZ __pyx_string_tab[175]
#define __pyx_n_u_ATOM __pyx_string_tab[176]
#define __pyx_n_u_BCast __pyx_string_tab[177]
#define __pyx_n_u_BGR __pyx_string_tab[178]
#define __pyx_n_u_CARDINAL __pyx_string_tab[179]
#define __pyx_n_u_CONNECTION_STR __pyx_string_tab[180]
#define __pyx_n_u_CSync __pyx_string_tab[181]
#define __pyx_n_u_CSyncNegative __pyx_string_tab[182]
#define __pyx_n_u_CSyncPositive __pyx_string_tab[183]
#define __pyx_n_u_ClockDivideBy2 __pyx_string_tab[184]
#define __pyx_n_u_Connected __pyx_string_tab[185]
#define __pyx_n_u_DEFAULT_REFRESH_RATE __pyx_string_tab[186]
#define __pyx_n_u_DeleteMonitor __pyx_string_tab[187]
#define __pyx_n_u_Dict __pyx_string_tab[188]
#define __pyx_n_u_Disconnected __pyx_string_tab[189]
#define __pyx_n_u_DoubleClock __pyx_string_tab[190]
#define __pyx_n_u_DoubleScan __pyx_string_tab[191]
#define __pyx_n_u_EDID __pyx_string_tab[192]
#define __pyx_n_u_GAMMA __pyx_string_tab[193]
#define __pyx_n_u_HEIGHT_MM __pyx_string_tab[194]
#define __pyx_n_u_HSkewPresent __pyx_string_tab[195]
#define __pyx_n_u_HSyncNegative __pyx_string_tab[196]
#define __pyx_n_u_HSyncPositive __pyx_string_tab[197]
#define __pyx_n_u_Hz __pyx_string_tab[198]
#define __pyx_n_u_INTEGER __pyx_string_tab[199]
#define __pyx_n_u_Interlace __pyx_string_tab[200]
#define __pyx_n_u_List __pyx_string_tab[201]
#define __pyx_n_u_Logger __pyx_string_tab[202]
#define __pyx_n_u_MAX_NEW_MODES __pyx_string_tab[203]
#define __pyx_n_u_MODE_FLAGS_STR __pyx_string_tab[204]
#define __pyx_n_u_None __pyx_string_tab[205]
#define __pyx_n_u_PixelMultiplex __pyx_string_tab[206]
#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[207]
#define __pyx_n_u_RGB __pyx_string_tab[208]
#define __pyx_n_u_ROTATIONS __pyx_string_tab[209]
#define __pyx_n_u_ROTATION_CONST __pyx_string_tab[210]
#define __pyx_n_u_RRMode __pyx_string_tab[211]
#define __pyx_n_u_RandRBindingsInstance __pyx_string_tab[212]
#define __pyx_n_u_RandRBindingsInstance_DeleteMoni __pyx_string_tab[213]
#define __pyx_n_u_RandRBindingsInstance__set_scree __pyx_string_tab[214]
#define __pyx_n_u_RandRBindingsInstance_add_screen __pyx_string_tab[215]
#define __pyx_n_u_RandRBindingsInstance_check_rand __pyx_string_tab[216]
#define __pyx_n_u_RandRBindingsInstance_get_all_sc __pyx_string_tab[217]
#define __pyx_n_u_RandRBindingsInstance_get_monito __pyx_string_tab[218]
#define __pyx_n_u_RandRBindingsInstance_get_screen __pyx_string_tab[219]
#define __pyx_n_u_RandRBindingsInstance_get_screen_2 __pyx_string_tab[220]
#define __pyx_n_u_RandRBindingsInstance_get_screen_3 __pyx_string_tab[221]
#define __pyx_n_u_RandRBindingsInstance_get_screen_4 __pyx_string_tab[222]
#define __pyx_n_u_RandRBindingsInstance_get_screen_5 __pyx_string_tab[223]
#define __pyx_n_u_RandRBindingsInstance_get_screen_6 __pyx_string_tab[224]
#define __pyx_n_u_RandRBindingsInstance_get_versio __pyx_string_tab[225]
#define __pyx_n_u_RandRBindingsInstance_get_vrefre __pyx_string_tab[226]
#define __pyx_n_u_RandRBindingsInstance_get_vrefre_2 __pyx_string_tab[227]
#define __pyx_n_u_RandRBindingsInstance_get_vrefre_3 __pyx_string_tab[228]
#define __pyx_n_u_RandRBindingsInstance_get_xrr_sc __pyx_string_tab[229]
#define __pyx_n_u_RandRBindingsInstance_has_mode __pyx_string_tab[230]
#define __pyx_n_u_RandRBindingsInstance_has_randr __pyx_string_tab[231]
#define __pyx_n_u_RandRBindingsInstance_is_dummy16 __pyx_string_tab[232]
#define __pyx_n_u_RandRBindingsInstance_remove_mod __pyx_string_tab[233]
#define __pyx_n_u_RandRBindingsInstance_remove_scr __pyx_string_tab[234]
#define __pyx_n_u_RandRBindingsInstance_select_crt __pyx_string_tab[235]
#define __pyx_n_u_RandRBindingsInstance_select_scr __pyx_string_tab[236]
#define __pyx_n_u_RandRBindingsInstance_set_crtc_c __pyx_string_tab[237]
#define __pyx_n_u_RandRBindingsInstance_set_output __pyx_string_tab[238]
#define __pyx_n_u_RandRBindingsInstance_set_screen __pyx_string_tab[239]
#define __pyx_n_u_RandRBindingsInstance_xrr_set_sc __pyx_string_tab[240]
#define __pyx_n_u_RandRBindings_2 __pyx_string_tab[241]
#define __pyx_n_u_SUBPIXEL_STR __pyx_string_tab[242]
#define __pyx_n_u_SUSPENDED __pyx_string_tab[243]
#define __pyx_n_u_ScreenChangeNotify __pyx_string_tab[244]
#define __pyx_n_u_TIMESTAMPS __pyx_string_tab[245]
#define __pyx_n_u_Tuple __pyx_string_tab[246]
#define __pyx_n_u_Unknown __pyx_string_tab[247]
#define __pyx_n_u_VBGR __pyx_string_tab[248]
#define __pyx_n_u_VFB __pyx_string_tab[249]
#define __pyx_n_u_VRGB __pyx_string_tab[250]
#define __pyx_n_u_VSyncNegative __pyx_string_tab[251]
#define __pyx_n_u_VSyncPositive __pyx_string_tab[252]
#define __pyx_n_u_WIDTH_MM __pyx_string_tab[253]
#define __pyx_n_u_XPRA_RANDR_GAMMA __pyx_string_tab[254]
#define __pyx_n_u_XPRA_RANDR_MAX_NEW_MODES __pyx_string_tab[255]
#define __pyx_n_u_XPRA_RANDR_TIMESTAMPS __pyx_string_tab[256]
#define __pyx_n_u_XSync __pyx_string_tab[257]
#define __pyx_n_u_active_names __pyx_string_tab[258]
#define __pyx_n_u_add_screen_mode __pyx_string_tab[259]
#define __pyx_n_u_add_screen_size __pyx_string_tab[260]
#define __pyx_n_u_all_names __pyx_string_tab[261]
#define __pyx_n_u_append __pyx_string_tab[262]
#define __pyx_n_u_asdict __pyx_string_tab[263]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[264]
#define __pyx_n_u_atom __pyx_string_tab[265]
#define __pyx_n_u_automatic __pyx_string_tab[266]
#define __pyx_n_u_basename __pyx_string_tab[267]
#define __pyx_n_u_bindings __pyx_string_tab[268]
#define __pyx_n_u_blue __pyx_string_tab[269]
#define __pyx_n_u_bool __pyx_string_tab[270]
#define __pyx_n_u_calcsize __pyx_string_tab[271]
#define __pyx_n_u_check_randr_sizes __pyx_string_tab[272]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[273]
#define __pyx_n_u_clones __pyx_string_tab[274]
#define __pyx_n_u_close __pyx_string_tab[275]
#define __pyx_n_u_config __pyx_string_tab[276]
#define __pyx_n_u_config_timestamp_2 __pyx_string_tab[277]
#define __pyx_n_u_connection __pyx_string_tab[278]
#define __pyx_n_u_context_check __pyx_string_tab[279]
#define __pyx_n_u_count __pyx_string_tab[280]
#define __pyx_n_u_crtc_2 __pyx_string_tab[281]
#define __pyx_n_u_crtc_info __pyx_string_tab[282]
#define __pyx_n_u_crtcs __pyx_string_tab[283]
#define __pyx_n_u_csv __pyx_string_tab[284]
#define __pyx_n_u_d __pyx_string_tab[285]
#define __pyx_n_u_data __pyx_string_tab[286]
#define __pyx_n_u_decode_str __pyx_string_tab[287]
#define __pyx_n_u_delete __pyx_string_tab[288]
#define __pyx_n_u_dict __pyx_string_tab[289]
#define __pyx_n_u_display __pyx_string_tab[290]
#define __pyx_n_u_dpi96 __pyx_string_tab[291]
#define __pyx_n_u_dpi_2 __pyx_string_tab[292]
#define __pyx_n_u_dpiinfo __pyx_string_tab[293]
#define __pyx_n_u_dpix __pyx_string_tab[294]
#define __pyx_n_u_dpiy __pyx_string_tab[295]
#define __pyx_n_u_encode __pyx_string_tab[296]
#define __pyx_n_u_envbool __pyx_string_tab[297]
#define __pyx_n_u_envint __pyx_string_tab[298]
#define __pyx_n_u_error __pyx_string_tab[299]
#define __pyx_n_u_error_base __pyx_string_tab[300]
#define __pyx_n_u_event_base __pyx_string_tab[301]
#define __pyx_n_u_exc_info __pyx_string_tab[302]
#define __pyx_n_u_ext __pyx_string_tab[303]
#define __pyx_n_u_ext_chars __pyx_string_tab[304]
#define __pyx_n_u_first_time __pyx_string_tab[305]
#define __pyx_n_u_func __pyx_string_tab[306]
#define __pyx_n_u_gamma __pyx_string_tab[307]
#define __pyx_n_u_genexpr __pyx_string_tab[308]
#define __pyx_n_u_geometry __pyx_string_tab[309]
#define __pyx_n_u_get __pyx_string_tab[310]
#define __pyx_n_u_get_all_screen_properties __pyx_string_tab[311]
#define __pyx_n_u_get_atom_name __pyx_string_tab[312]
#define __pyx_n_u_get_crtc_info_locals_genexpr __pyx_string_tab[313]
#define __pyx_n_u_get_current_output __pyx_string_tab[314]
#define __pyx_n_u_get_mode_info_locals_genexpr __pyx_string_tab[315]
#define __pyx_n_u_get_monitor_properties __pyx_string_tab[316]
#define __pyx_n_u_get_output_info_locals_genexpr __pyx_string_tab[317]
#define __pyx_n_u_get_output_properties_locals_gen __pyx_string_tab[318]
#define __pyx_n_u_get_rotation __pyx_string_tab[319]
#define __pyx_n_u_get_rotations __pyx_string_tab[320]
#define __pyx_n_u_get_screen_count __pyx_string_tab[321]
#define __pyx_n_u_get_screen_size __pyx_string_tab[322]
#define __pyx_n_u_get_screen_size_mm __pyx_string_tab[323]
#define __pyx_n_u_get_screen_size_range __pyx_string_tab[324]
#define __pyx_n_u_get_screen_sizes __pyx_string_tab[325]
#define __pyx_n_u_get_screen_sizes_mm __pyx_string_tab[326]
#define __pyx_n_u_get_version __pyx_string_tab[327]
#define __pyx_n_u_get_vrefresh __pyx_string_tab[328]
#define __pyx_n_u_get_vrefresh_display __pyx_string_tab[329]
#define __pyx_n_u_get_vrefresh_outputs __pyx_string_tab[330]
#define __pyx_n_u_get_xrr_screen_sizes_2 __pyx_string_tab[331]
#define __pyx_n_u_green __pyx_string_tab[332]
#define __pyx_n_u_h __pyx_string_tab[333]
#define __pyx_n_u_has_mode __pyx_string_tab[334]
#define __pyx_n_u_has_randr __pyx_string_tab[335]
#define __pyx_n_u_height __pyx_string_tab[336]
#define __pyx_n_u_hmm __pyx_string_tab[337]
#define __pyx_n_u_hz __pyx_string_tab[338]
#define __pyx_n_u_hzstr __pyx_string_tab[339]
#define __pyx_n_u_i_2 __pyx_string_tab[340]
#define __pyx_n_u_id __pyx_string_tab[341]
#define __pyx_n_u_index __pyx_string_tab[342]
#define __pyx_n_u_info __pyx_string_tab[343]
#define __pyx_n_u_init_xrandr_events __pyx_string_tab[344]
#define __pyx_n_u_int __pyx_string_tab[345]
#define __pyx_n_u_is_coroutine __pyx_string_tab[346]
#define __pyx_n_u_is_dummy16 __pyx_string_tab[347]
#define __pyx_n_u_items __pyx_string_tab[348]
#define __pyx_n_u_j __pyx_string_tab[349]
#define __pyx_n_u_k __pyx_string_tab[350]
#define __pyx_n_u_keys __pyx_string_tab[351]
#define __pyx_n_u_latin1 __pyx_string_tab[352]
#define __pyx_n_u_log __pyx_string_tab[353]
#define __pyx_n_u_m __pyx_string_tab[354]
#define __pyx_n_u_main __pyx_string_tab[355]
#define __pyx_n_u_mask __pyx_string_tab[356]
#define __pyx_n_u_match_mode __pyx_string_tab[357]
#define __pyx_n_u_max __pyx_string_tab[358]
#define __pyx_n_u_maxHeight __pyx_string_tab[359]
#define __pyx_n_u_maxWidth __pyx_string_tab[360]
#define __pyx_n_u_maxx __pyx_string_tab[361]
#define __pyx_n_u_maxy __pyx_string_tab[362]
#define __pyx_n_u_mheight __pyx_string_tab[363]
#define __pyx_n_u_mi __pyx_string_tab[364]
#define __pyx_n_u_min __pyx_string_tab[365]
#define __pyx_n_u_minHeight __pyx_string_tab[366]
#define __pyx_n_u_minWidth __pyx_string_tab[367]
#define __pyx_n_u_mmh __pyx_string_tab[368]
#define __pyx_n_u_mmw __pyx_string_tab[369]
#define __pyx_n_u_mode __pyx_string_tab[370]
#define __pyx_n_u_mode_info __pyx_string_tab[371]
#define __pyx_n_u_mode_name __pyx_string_tab[372]
#define __pyx_n_u_modes __pyx_string_tab[373]
#define __pyx_n_u_module __pyx_string_tab[374]
#define __pyx_n_u_monitor_2 __pyx_string_tab[375]
#define __pyx_n_u_monitor_defs __pyx_string_tab[376]
#define __pyx_n_u_monitor_names __pyx_string_tab[377]
#define __pyx_n_u_monitor_properties_locals_genex __pyx_string_tab[378]
#define __pyx_n_u_monitors __pyx_string_tab[379]
#define __pyx_n_u_monotonic __pyx_string_tab[380]
#define __pyx_n_u_mwidth __pyx_string_tab[381]
#define __pyx_n_u_n __pyx_string_tab[382]
#define __pyx_n_u_name __pyx_string_tab[383]
#define __pyx_n_u_name_2 __pyx_string_tab[384]
#define __pyx_n_u_name_atom __pyx_string_tab[385]
#define __pyx_n_u_new_modes __pyx_string_tab[386]
#define __pyx_n_u_next __pyx_string_tab[387]
#define __pyx_n_u_nmonitors __pyx_string_tab[388]
#define __pyx_n_u_none __pyx_string_tab[389]
#define __pyx_n_u_noutput __pyx_string_tab[390]
#define __pyx_n_u_npossible __pyx_string_tab[391]
#define __pyx_n_u_num_sizes __pyx_string_tab[392]
#define __pyx_n_u_o __pyx_string_tab[393]
#define __pyx_n_u_output_2 __pyx_string_tab[394]
#define __pyx_n_u_output_info __pyx_string_tab[395]
#define __pyx_n_u_output_names __pyx_string_tab[396]
#define __pyx_n_u_outputs __pyx_string_tab[397]
#define __pyx_n_u_pack __pyx_string_tab[398]
#define __pyx_n_u_parse_edid __pyx_string_tab[399]
#define __pyx_n_u_posinfo __pyx_string_tab[400]
#define __pyx_n_u_prettify_plug_name __pyx_string_tab[401]
#define __pyx_n_u_primary __pyx_string_tab[402]
#define __pyx_n_u_prop __pyx_string_tab[403]
#define __pyx_n_u_prop_name __pyx_string_tab[404]
#define __pyx_n_u_properties __pyx_string_tab[405]
#define __pyx_n_u_ptype __pyx_string_tab[406]
#define __pyx_n_u_pyedid __pyx_string_tab[407]
#define __pyx_n_u_pyx_capi __pyx_string_tab[408]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[409]
#define __pyx_n_u_qualname __pyx_string_tab[410]
#define __pyx_n_u_r __pyx_string_tab[411]
#define __pyx_n_u_randr __pyx_string_tab[412]
#define __pyx_n_u_rate __pyx_string_tab[413]
#define __pyx_n_u_rates __pyx_string_tab[414]
#define __pyx_n_u_red __pyx_string_tab[415]
#define __pyx_n_u_remove_mode __pyx_string_tab[416]
#define __pyx_n_u_remove_screen_size __pyx_string_tab[417]
#define __pyx_n_u_renum __pyx_string_tab[418]
#define __pyx_n_u_return __pyx_string_tab[419]
#define __pyx_n_u_root __pyx_string_tab[420]
#define __pyx_n_u_root_h __pyx_string_tab[421]
#define __pyx_n_u_root_w __pyx_string_tab[422]
#define __pyx_n_u_rotation __pyx_string_tab[423]
#define __pyx_n_u_rotation_int __pyx_string_tab[424]
#define __pyx_n_u_rotations __pyx_string_tab[425]
#define __pyx_n_u_round __pyx_string_tab[426]
#define __pyx_n_u_rro __pyx_string_tab[427]
#define __pyx_n_u_rsc __pyx_string_tab[428]
#define __pyx_n_u_rstrip __pyx_string_tab[429]
#define __pyx_n_u_rval __pyx_string_tab[430]
#define __pyx_n_u_screen_h __pyx_string_tab[431]
#define __pyx_n_u_screen_w __pyx_string_tab[432]
#define __pyx_n_u_select_crtc_output_changes __pyx_string_tab[433]
#define __pyx_n_u_select_screen_changes __pyx_string_tab[434]
#define __pyx_n_u_self __pyx_string_tab[435]
#define __pyx_n_u_send __pyx_string_tab[436]
#define __pyx_n_u_seq __pyx_string_tab[437]
#define __pyx_n_u_set_crtc_config __pyx_string_tab[438]
#define __pyx_n_u_set_crtc_config_locals_dpi96 __pyx_string_tab[439]
#define __pyx_n_u_set_name __pyx_string_tab[440]
#define __pyx_n_u_set_output_int_property __pyx_string_tab[441]
#define __pyx_n_u_set_screen_size_2 __pyx_string_tab[442]
#define __pyx_n_u_setdefault __pyx_string_tab[443]
#define __pyx_n_u_size_index __pyx_string_tab[444]
#define __pyx_n_u_sizes __pyx_string_tab[445]
#define __pyx_n_u_status __pyx_string_tab[446]
#define __pyx_n_u_str __pyx_string_tab[447]
#define __pyx_n_u_struct __pyx_string_tab[448]
#define __pyx_n_u_subpixel_order_2 __pyx_string_tab[449]
#define __pyx_n_u_test __pyx_string_tab[450]
#define __pyx_n_u_th __pyx_string_tab[451]
#define __pyx_n_u_throw __pyx_string_tab[452]
#define __pyx_n_u_time __pyx_string_tab[453]
#define __pyx_n_u_timestamp __pyx_string_tab[454]
#define __pyx_n_u_tw __pyx_string_tab[455]
#define __pyx_n_u_typing __pyx_string_tab[456]
#define __pyx_n_u_unknown __pyx_string_tab[457]
#define __pyx_n_u_unpack __pyx_string_tab[458]
#define __pyx_n_u_v __pyx_string_tab[459]
#define __pyx_n_u_value __pyx_string_tab[460]
#define __pyx_n_u_values __pyx_string_tab[461]
#define __pyx_n_u_version __pyx_string_tab[462]
#define __pyx_n_u_voutputs __pyx_string_tab[463]
#define __pyx_n_u_vrefresh __pyx_string_tab[464]
#define __pyx_n_u_w __pyx_string_tab[465]
#define __pyx_n_u_warn __pyx_string_tab[466]
#define __pyx_n_u_width __pyx_string_tab[467]
#define __pyx_n_u_window __pyx_string_tab[468]
#define __pyx_n_u_wmm __pyx_string_tab[469]
#define __pyx_n_u_x __pyx_string_tab[470]
#define __pyx_n_u_x11 __pyx_string_tab[471]
#define __pyx_n_u_xpra_common __pyx_string_tab[472]
#define __pyx_n_u_xpra_log __pyx_string_tab[473]
#define __pyx_n_u_xpra_util_env __pyx_string_tab[474]
#define __pyx_n_u_xpra_util_screen __pyx_string_tab[475]
#define __pyx_n_u_xpra_util_str_fn __pyx_string_tab[476]
#define __pyx_n_u_xpra_x11_bindings_randr __pyx_string_tab[477]
#define __pyx_n_u_xrr_set_screen_size __pyx_string_tab[478]
#define __pyx_n_u_y __pyx_string_tab[479]
#define __pyx_kp_b_Display_void_get_display __pyx_string_tab[480]
#define __pyx_kp_b_PyObject_Display_get_all_screen __pyx_string_tab[481]
#define __pyx_kp_b_PyObject_PyObject_name_PyObject __pyx_string_tab[482]
#define __pyx_kp_b_iso88591_1 __pyx_string_tab[483]
#define __pyx_kp_b_iso88591_1D __pyx_string_tab[484]
#define __pyx_kp_b_iso88591_1_N_1_Q __pyx_string_tab[485]
#define __pyx_kp_b_iso88591_1_q_A_at_Q_6_1_q_1_Q_axq_1HAQ_z __pyx_string_tab[486]
#define __pyx_kp_b_iso88591_1_q_A_d_aq_Zxq_F __pyx_string_tab[487]
#define __pyx_kp_b_iso88591_1_t1D __pyx_string_tab[488]
#define __pyx_kp_b_iso88591_5_2U_A __pyx_string_tab[489]
#define __pyx_kp_b_iso88591_8_t_AWA __pyx_string_tab[490]
#define __pyx_kp_b_iso88591_9D_A __pyx_string_tab[491]
#define __pyx_kp_b_iso88591_A __pyx_string_tab[492]
#define __pyx_kp_b_iso88591_A_1_3J_Leeggh_Qd_at_V1 __pyx_string_tab[493]
#define __pyx_kp_b_iso88591_A_E_A_1_6a_CuA_t1 __pyx_string_tab[494]
#define __pyx_kp_b_iso88591_A_Kq_t_AYa_1A_5_q_Q_5_Na_q_Rq_X __pyx_string_tab[495]
#define __pyx_kp_b_iso88591_A_N_1_4t1_q_1_4xr_A_q_6at1_1_q __pyx_string_tab[496]
#define __pyx_kp_b_iso88591_DA_xs_Q_4_D_q_5_D_AQ_M __pyx_string_tab[497]
#define __pyx_kp_b_iso88591_EQ_N_1_q_A_1_d_T___bbggh_Zxs_U __pyx_string_tab[498]
#define __pyx_kp_b_iso88591_HA_q_q_m_q_m1A_q_a_xs_Q_5_I_q_Q __pyx_string_tab[499]
#define __pyx_kp_b_iso88591_IQ_N_1_1_aq_S_E_WA_s_1A_Qaq_Qaq __pyx_string_tab[500]
#define __pyx_kp_b_iso88591_N_1_a __pyx_string_tab[501]
#define __pyx_kp_b_iso88591_N_1_q_A_C1D_RS_U_3a_3fARvRr_S_a __pyx_string_tab[502]
#define __pyx_kp_b_iso88591_N_1_t_6a_1N_5_A_q_Jha_4z __pyx_string_tab[503]
#define __pyx_kp_b_iso88591_PPQ_N_1_q_A_C1D_RS_3b_vQa_1_6_C __pyx_string_tab[504]
#define __pyx_kp_b_iso88591_Q __pyx_string_tab[505]
#define __pyx_kp_b_iso88591_Q_2 __pyx_string_tab[506]
#define __pyx_kp_b_iso88591_Q_l_4q_A_E_aq_q_Ja_Zq_Q_q __pyx_string_tab[507]
#define __pyx_kp_b_iso88591_Q_t1 __pyx_string_tab[508]
#define __pyx_kp_b_iso88591_TTmmn_Yb_1A_5_Qe2Q_E_WAQ_r_Qd_t __pyx_string_tab[509]
#define __pyx_kp_b_iso88591__12 __pyx_string_tab[510]
#define __pyx_kp_b_iso88591_a __pyx_string_tab[511]
#define __pyx_kp_b_iso88591_a_4_A_1_3axwa_t __pyx_string_tab[512]
#define __pyx_kp_b_iso88591_a_D_a_1_Qa_q __pyx_string_tab[513]
#define __pyx_kp_b_iso88591_a_q_A_a_a_C1D_RS_3b_vQa_1_Qc_N __pyx_string_tab[514]
#define __pyx_kp_b_iso88591_a_q_A_at_Q_6_1_vQa_1_q_1A __pyx_string_tab[515]
#define __pyx_kp_b_iso88591_l_4q_A_E_aq_Qd_A_at_Q_Q_q __pyx_string_tab[516]
#define __pyx_kp_b_iso88591_q __pyx_string_tab[517]
#define __pyx_kp_b_iso88591_q_2 __pyx_string_tab[518]
#define __pyx_kp_b_iso88591_q_A_a_C1D_RS_4q_aq_wa_Qc_N_4z_c __pyx_string_tab[519]
#define __pyx_kp_b_iso88591_q_Qd_at_V1 __pyx_string_tab[520]
#define __pyx_kp_b_iso88591_q_q_A_2_4z_TUU_aakkllm_7_Q_aq_q __pyx_string_tab[521]
#define __pyx_kp_b_iso88591_q_z_A_1 __pyx_string_tab[522]
#define __pyx_kp_b_iso88591_xy_a_6_1_WAQ_1 __pyx_string_tab[523]
#define __pyx_kp_b_s __pyx_string_tab[524]
#define __pyx_kp_b_void_PyObject_import_check __pyx_string_tab[525]
#define __pyx_kp_b_void_int_PyObject_PyObject_PyObj __pyx_string_tab[526]
#define __pyx_n_b_B __pyx_string_tab[527]
#define __pyx_n_b_H __pyx_string_tab[528]
#define __pyx_n_b_L __pyx_string_tab[529]
#define __pyx_float_25_4 __pyx_number_tab[0]
#define __pyx_float_60_0 __pyx_number_tab[1]
#define __pyx_int_0 __pyx_number_tab[2]
#define __pyx_int_1 __pyx_number_tab[3]
#define __pyx_int_2 __pyx_number_tab[4]
#define __pyx_int_3 __pyx_number_tab[5]
#define __pyx_int_6 __pyx_number_tab[6]
#define __pyx_int_32 __pyx_number_tab[7]
#define __pyx_int_90 __pyx_number_tab[8]
#define __pyx_int_96 __pyx_number_tab[9]
#define __pyx_int_180 __pyx_number_tab[10]
#define __pyx_int_270 __pyx_number_tab[11]
#define __pyx_int_768 __pyx_number_tab[12]
#define __pyx_int_1000 __pyx_number_tab[13]
#define __pyx_int_1024 __pyx_number_tab[14]
#define __pyx_int_4294967295 __pyx_number_tab[15]
#define __pyx_int_30000000000 __pyx_number_tab[16]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr);
  for (int i=0; i<14; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<42; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<530; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<17; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_clear_contents ### */
/* CommonTypesMetaclass.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CyFunctionType);

/* Generator.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_clear_end ### */
return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr);
  for (int i=0; i<14; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<42; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<530; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<17; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_traverse_contents ### */
/* CommonTypesMetaclass.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CyFunctionType);

/* Generator.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_traverse_end ### */
return 0;
}
#endif
/* #### Code section: module_code ### */

/* "xpra/x11/bindings/randr.pyx":121
 * 
 * 
 * def get_rotation(Rotation v) -> int:             # <<<<<<<<<<<<<<
 *     return ROTATIONS.get(v, 0)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_1get_rotation(PyObject *__pyx_self, PyObject *__pyx_arg_v); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_1get_rotation = {"get_rotation", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_1get_rotation, METH_O, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_1get_rotation(PyObject *__pyx_self, PyObject *__pyx_arg_v) {
  Rotation __pyx_v_v;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_rotation (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  assert(__pyx_arg_v); {
    __pyx_v_v = __Pyx_PyLong_As_Rotation(__pyx_arg_v); if (unlikely((__pyx_v_v == ((Rotation)-1)) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_rotation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_get_rotation(__pyx_self, ((Rotation)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_get_rotation(CYTHON_UNUSED PyObject *__pyx_self, Rotation __pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_rotation", 0);

  /* "xpra/x11/bindings/randr.pyx":122
 * 
 * def get_rotation(Rotation v) -> int:
 *     return ROTATIONS.get(v, 0)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ROTATIONS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_Rotation(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_mstate_global->__pyx_int_0};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":121
 * 
 * 
 * def get_rotation(Rotation v) -> int:             # <<<<<<<<<<<<<<
 *     return ROTATIONS.get(v, 0)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_rotation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":125
 * 
 * 
 * def get_rotations(Rotation v) -> List[int]:             # <<<<<<<<<<<<<<
 *     rotations = []
 *     for renum, rval in ROTATIONS.items():
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_3get_rotations(PyObject *__pyx_self, PyObject *__pyx_arg_v); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_3get_rotations = {"get_rotations", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_3get_rotations, METH_O, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_3get_rotations(PyObject *__pyx_self, PyObject *__pyx_arg_v) {
  Rotation __pyx_v_v;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_rotations (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  assert(__pyx_arg_v); {
    __pyx_v_v = __Pyx_PyLong_As_Rotation(__pyx_arg_v); if (unlikely((__pyx_v_v == ((Rotation)-1)) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_rotations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_2get_rotations(__pyx_self, ((Rotation)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_2get_rotations(CYTHON_UNUSED PyObject *__pyx_self, Rotation __pyx_v_v) {
  PyObject *__pyx_v_rotations = NULL;
  PyObject *__pyx_v_renum = NULL;
  PyObject *__pyx_v_rval = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_rotations", 0);

  /* "xpra/x11/bindings/randr.pyx":126
 * 
 * def get_rotations(Rotation v) -> List[int]:
 *     rotations = []             # <<<<<<<<<<<<<<
 *     for renum, rval in ROTATIONS.items():
 *         if renum & v:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rotations = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":127
 * def get_rotations(Rotation v) -> List[int]:
 *     rotations = []
 *     for renum, rval in ROTATIONS.items():             # <<<<<<<<<<<<<<
 *         if renum & v:
 *             rotations.append(rval)
*/
  __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ROTATIONS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(__pyx_t_5 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 127, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_renum, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_rval, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":128
 *     rotations = []
 *     for renum, rval in ROTATIONS.items():
 *         if renum & v:             # <<<<<<<<<<<<<<
 *             rotations.append(rval)
 *     return rotations
*/
    __pyx_t_5 = __Pyx_PyLong_From_Rotation(__pyx_v_v); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_And(__pyx_v_renum, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_8) {

      /* "xpra/x11/bindings/randr.pyx":129
 *     for renum, rval in ROTATIONS.items():
 *         if renum & v:
 *             rotations.append(rval)             # <<<<<<<<<<<<<<
 *     return rotations
 * 
*/
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_rotations, __pyx_v_rval); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 129, __pyx_L1_error)

      /* "xpra/x11/bindings/randr.pyx":128
 *     rotations = []
 *     for renum, rval in ROTATIONS.items():
 *         if renum & v:             # <<<<<<<<<<<<<<
 *             rotations.append(rval)
 *     return rotations
*/
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":130
 *         if renum & v:
 *             rotations.append(rval)
 *     return rotations             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rotations);
  __pyx_r = __pyx_v_rotations;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":125
 * 
 * 
 * def get_rotations(Rotation v) -> List[int]:             # <<<<<<<<<<<<<<
 *     rotations = []
 *     for renum, rval in ROTATIONS.items():
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_rotations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rotations);
  __Pyx_XDECREF(__pyx_v_renum);
  __Pyx_XDECREF(__pyx_v_rval);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_mode_info_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":346
 *             "v-sync-end"    : mi.vSyncEnd,
 *             "v-total"       : mi.vTotal,
 *             "mode-flags"    : tuple(name for v,name in MODE_FLAGS_STR.items() if mi.modeFlags & v),             # <<<<<<<<<<<<<<
 *         }
 *     return info
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_mode_info_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 346, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_13get_mode_info_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_mode_info_locals_genexpr, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_mode_info.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_mode_info_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 346, __pyx_L1_error)
  }
  __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 346, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_genexpr_arg_0 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 346, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_genexpr_arg_0, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyLong_From_XRRModeFlags(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_mi->modeFlags); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyNumber_And(__pyx_t_6, __pyx_cur_scope->__pyx_v_v); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
      __pyx_r = __pyx_cur_scope->__pyx_v_name;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 346, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":328
 * 
 * 
 * cdef dict get_mode_info(XRRModeInfo *mi, with_sync: bool):             # <<<<<<<<<<<<<<
 *     info = {
 *         "id"            : mi.id,
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info(XRRModeInfo *__pyx_v_mi, int __pyx_v_with_sync) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info *__pyx_cur_scope;
  PyObject *__pyx_v_info = NULL;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_mode_info_2generator = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_mode_info", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 328, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_mi = __pyx_v_mi;

  /* "xpra/x11/bindings/randr.pyx":330
 * cdef dict get_mode_info(XRRModeInfo *mi, with_sync: bool):
 *     info = {
 *         "id"            : mi.id,             # <<<<<<<<<<<<<<
 *         "width"         : mi.width,
 *         "height"        : mi.height,
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_mi->id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_id, __pyx_t_2) < (0)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":331
 *     info = {
 *         "id"            : mi.id,
 *         "width"         : mi.width,             # <<<<<<<<<<<<<<
 *         "height"        : mi.height,
 *     }
*/
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_width, __pyx_t_2) < (0)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":332
 *         "id"            : mi.id,
 *         "width"         : mi.width,
 *         "height"        : mi.height,             # <<<<<<<<<<<<<<
 *     }
 *     if mi.name and mi.nameLength:
*/
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_height, __pyx_t_2) < (0)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":334
 *         "height"        : mi.height,
 *     }
 *     if mi.name and mi.nameLength:             # <<<<<<<<<<<<<<
 *         info["name"] = s(mi.name[:mi.nameLength])
 *     if with_sync:
*/
  __pyx_t_4 = (__pyx_cur_scope->__pyx_v_mi->name != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_cur_scope->__pyx_v_mi->nameLength != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "xpra/x11/bindings/randr.pyx":335
 *     }
 *     if mi.name and mi.nameLength:
 *         info["name"] = s(mi.name[:mi.nameLength])             # <<<<<<<<<<<<<<
 *     if with_sync:
 *         info |= {
*/
    __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_cur_scope->__pyx_v_mi->name + 0, __pyx_cur_scope->__pyx_v_mi->nameLength - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error)
    __pyx_t_2 = __pyx_f_4xpra_3x11_8bindings_5randr_s(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_name, __pyx_t_2) < 0))) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":334
 *         "height"        : mi.height,
 *     }
 *     if mi.name and mi.nameLength:             # <<<<<<<<<<<<<<
 *         info["name"] = s(mi.name[:mi.nameLength])
 *     if with_sync:
*/
  }

  /* "xpra/x11/bindings/randr.pyx":336
 *     if mi.name and mi.nameLength:
 *         info["name"] = s(mi.name[:mi.nameLength])
 *     if with_sync:             # <<<<<<<<<<<<<<
 *         info |= {
 *             "dot-clock"     : mi.dotClock,
*/
  if (__pyx_v_with_sync) {

    /* "xpra/x11/bindings/randr.pyx":338
 *     if with_sync:
 *         info |= {
 *             "dot-clock"     : mi.dotClock,             # <<<<<<<<<<<<<<
 *             "h-sync-start"  : mi.hSyncStart,
 *             "h-sync-end"    : mi.hSyncEnd,
*/
    __pyx_t_2 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_mi->dotClock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_dot_clock, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":339
 *         info |= {
 *             "dot-clock"     : mi.dotClock,
 *             "h-sync-start"  : mi.hSyncStart,             # <<<<<<<<<<<<<<
 *             "h-sync-end"    : mi.hSyncEnd,
 *             "h-total"       : mi.hTotal,
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->hSyncStart); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_h_sync_start, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":340
 *             "dot-clock"     : mi.dotClock,
 *             "h-sync-start"  : mi.hSyncStart,
 *             "h-sync-end"    : mi.hSyncEnd,             # <<<<<<<<<<<<<<
 *             "h-total"       : mi.hTotal,
 *             "h-skew"        : mi.hSkew,
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->hSyncEnd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_h_sync_end, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":341
 *             "h-sync-start"  : mi.hSyncStart,
 *             "h-sync-end"    : mi.hSyncEnd,
 *             "h-total"       : mi.hTotal,             # <<<<<<<<<<<<<<
 *             "h-skew"        : mi.hSkew,
 *             "v-sync-start"  : mi.vSyncStart,
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->hTotal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_h_total, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":342
 *             "h-sync-end"    : mi.hSyncEnd,
 *             "h-total"       : mi.hTotal,
 *             "h-skew"        : mi.hSkew,             # <<<<<<<<<<<<<<
 *             "v-sync-start"  : mi.vSyncStart,
 *             "v-sync-end"    : mi.vSyncEnd,
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->hSkew); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_h_skew, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":343
 *             "h-total"       : mi.hTotal,
 *             "h-skew"        : mi.hSkew,
 *             "v-sync-start"  : mi.vSyncStart,             # <<<<<<<<<<<<<<
 *             "v-sync-end"    : mi.vSyncEnd,
 *             "v-total"       : mi.vTotal,
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->vSyncStart); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_v_sync_start, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":344
 *             "h-skew"        : mi.hSkew,
 *             "v-sync-start"  : mi.vSyncStart,
 *             "v-sync-end"    : mi.vSyncEnd,             # <<<<<<<<<<<<<<
 *             "v-total"       : mi.vTotal,
 *             "mode-flags"    : tuple(name for v,name in MODE_FLAGS_STR.items() if mi.modeFlags & v),
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->vSyncEnd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_v_sync_end, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":345
 *             "v-sync-start"  : mi.vSyncStart,
 *             "v-sync-end"    : mi.vSyncEnd,
 *             "v-total"       : mi.vTotal,             # <<<<<<<<<<<<<<
 *             "mode-flags"    : tuple(name for v,name in MODE_FLAGS_STR.items() if mi.modeFlags & v),
 *         }
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_mi->vTotal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_v_total, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":346
 *             "v-sync-end"    : mi.vSyncEnd,
 *             "v-total"       : mi.vTotal,
 *             "mode-flags"    : tuple(name for v,name in MODE_FLAGS_STR.items() if mi.modeFlags & v),             # <<<<<<<<<<<<<<
 *         }
 *     return info
*/
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_MODE_FLAGS_STR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __pyx_pf_4xpra_3x11_8bindings_5randr_13get_mode_info_genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_mode_flags, __pyx_t_1) < (0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":337
 *         info["name"] = s(mi.name[:mi.nameLength])
 *     if with_sync:
 *         info |= {             # <<<<<<<<<<<<<<
 *             "dot-clock"     : mi.dotClock,
 *             "h-sync-start"  : mi.hSyncStart,
*/
    __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_info, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_info, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":336
 *     if mi.name and mi.nameLength:
 *         info["name"] = s(mi.name[:mi.nameLength])
 *     if with_sync:             # <<<<<<<<<<<<<<
 *         info |= {
 *             "dot-clock"     : mi.dotClock,
*/
  }

  /* "xpra/x11/bindings/randr.pyx":348
 *             "mode-flags"    : tuple(name for v,name in MODE_FLAGS_STR.items() if mi.modeFlags & v),
 *         }
 *     return info             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_info);
  __pyx_r = __pyx_v_info;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":328
 * 
 * 
 * cdef dict get_mode_info(XRRModeInfo *mi, with_sync: bool):             # <<<<<<<<<<<<<<
 *     info = {
 *         "id"            : mi.id,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_mode_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_13get_mode_info_2generator);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_15get_output_info_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":371
 *             info["subpixel-order"] = so
 *         if oi.nclone:
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))             # <<<<<<<<<<<<<<
 *         info["properties"] = get_output_properties(display, output)
 *     if oi.name and oi.nameLen:
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_15get_output_info_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 371, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_15get_output_info_2generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_output_info_locals_genexpr, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_output_info.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_15get_output_info_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 371, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_oi->clones[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 371, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":351
 * 
 * 
 * cdef dict get_output_info(Display *display, XRRScreenResources *rsc, RROutput output):             # <<<<<<<<<<<<<<
 *     cdef XRROutputInfo *oi = XRRGetOutputInfo(display, rsc, output)
 *     if oi==NULL:
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_output_info(Display *__pyx_v_display, XRRScreenResources *__pyx_v_rsc, RROutput __pyx_v_output) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info *__pyx_cur_scope;
  PyObject *__pyx_v_info = NULL;
  PyObject *__pyx_v_so = NULL;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_15get_output_info_2generator1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_output_info", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 351, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }

  /* "xpra/x11/bindings/randr.pyx":352
 * 
 * cdef dict get_output_info(Display *display, XRRScreenResources *rsc, RROutput output):
 *     cdef XRROutputInfo *oi = XRRGetOutputInfo(display, rsc, output)             # <<<<<<<<<<<<<<
 *     if oi==NULL:
 *         return {}
*/
  __pyx_cur_scope->__pyx_v_oi = XRRGetOutputInfo(__pyx_v_display, __pyx_v_rsc, __pyx_v_output);

  /* "xpra/x11/bindings/randr.pyx":353
 * cdef dict get_output_info(Display *display, XRRScreenResources *rsc, RROutput output):
 *     cdef XRROutputInfo *oi = XRRGetOutputInfo(display, rsc, output)
 *     if oi==NULL:             # <<<<<<<<<<<<<<
 *         return {}
 *     info = {
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_oi == NULL);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":354
 *     cdef XRROutputInfo *oi = XRRGetOutputInfo(display, rsc, output)
 *     if oi==NULL:
 *         return {}             # <<<<<<<<<<<<<<
 *     info = {
 *         "id"                : output,
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":353
 * cdef dict get_output_info(Display *display, XRRScreenResources *rsc, RROutput output):
 *     cdef XRROutputInfo *oi = XRRGetOutputInfo(display, rsc, output)
 *     if oi==NULL:             # <<<<<<<<<<<<<<
 *         return {}
 *     info = {
*/
  }

  /* "xpra/x11/bindings/randr.pyx":356
 *         return {}
 *     info = {
 *         "id"                : output,             # <<<<<<<<<<<<<<
 *         "connection"        : CONNECTION_STR.get(oi.connection, "%i" % oi.connection),
 *         }
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_From_unsigned_long(__pyx_v_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_id, __pyx_t_3) < (0)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "xpra/x11/bindings/randr.pyx":357
 *     info = {
 *         "id"                : output,
 *         "connection"        : CONNECTION_STR.get(oi.connection, "%i" % oi.connection),             # <<<<<<<<<<<<<<
 *         }
 *     if oi.connection!=RR_Disconnected:
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_CONNECTION_STR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyLong_From_Connection(__pyx_cur_scope->__pyx_v_oi->connection); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyLong_From_Connection(__pyx_cur_scope->__pyx_v_oi->connection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_i, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_9 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_9 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_connection, __pyx_t_3) < (0)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_info = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":359
 *         "connection"        : CONNECTION_STR.get(oi.connection, "%i" % oi.connection),
 *         }
 *     if oi.connection!=RR_Disconnected:             # <<<<<<<<<<<<<<
 *         info |= {
 *             "width-mm"          : oi.mm_width,
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_oi->connection != RR_Disconnected);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":361
 *     if oi.connection!=RR_Disconnected:
 *         info |= {
 *             "width-mm"          : oi.mm_width,             # <<<<<<<<<<<<<<
 *             "height-mm"         : oi.mm_height,
 *             "preferred-mode"    : oi.npreferred,
*/
    __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_oi->mm_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_width_mm, __pyx_t_3) < (0)) __PYX_ERR(0, 361, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":362
 *         info |= {
 *             "width-mm"          : oi.mm_width,
 *             "height-mm"         : oi.mm_height,             # <<<<<<<<<<<<<<
 *             "preferred-mode"    : oi.npreferred,
 *         }
*/
    __pyx_t_3 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_oi->mm_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_height_mm, __pyx_t_3) < (0)) __PYX_ERR(0, 361, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":363
 *             "width-mm"          : oi.mm_width,
 *             "height-mm"         : oi.mm_height,
 *             "preferred-mode"    : oi.npreferred,             # <<<<<<<<<<<<<<
 *         }
 *         if TIMESTAMPS:
*/
    __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_oi->npreferred); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_preferred_mode, __pyx_t_3) < (0)) __PYX_ERR(0, 361, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":360
 *         }
 *     if oi.connection!=RR_Disconnected:
 *         info |= {             # <<<<<<<<<<<<<<
 *             "width-mm"          : oi.mm_width,
 *             "height-mm"         : oi.mm_height,
*/
    __pyx_t_3 = PyNumber_InPlaceOr(__pyx_v_info, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_info, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":365
 *             "preferred-mode"    : oi.npreferred,
 *         }
 *         if TIMESTAMPS:             # <<<<<<<<<<<<<<
 *             info["timestamp"] = oi.timestamp
 *         so = SUBPIXEL_STR.get(oi.subpixel_order)
*/
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_TIMESTAMPS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "xpra/x11/bindings/randr.pyx":366
 *         }
 *         if TIMESTAMPS:
 *             info["timestamp"] = oi.timestamp             # <<<<<<<<<<<<<<
 *         so = SUBPIXEL_STR.get(oi.subpixel_order)
 *         if so and so!="unknown":
*/
      __pyx_t_3 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_oi->timestamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_timestamp, __pyx_t_3) < 0))) __PYX_ERR(0, 366, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "xpra/x11/bindings/randr.pyx":365
 *             "preferred-mode"    : oi.npreferred,
 *         }
 *         if TIMESTAMPS:             # <<<<<<<<<<<<<<
 *             info["timestamp"] = oi.timestamp
 *         so = SUBPIXEL_STR.get(oi.subpixel_order)
*/
    }

    /* "xpra/x11/bindings/randr.pyx":367
 *         if TIMESTAMPS:
 *             info["timestamp"] = oi.timestamp
 *         so = SUBPIXEL_STR.get(oi.subpixel_order)             # <<<<<<<<<<<<<<
 *         if so and so!="unknown":
 *             info["subpixel-order"] = so
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_SUBPIXEL_STR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyLong_From_SubpixelOrder(__pyx_cur_scope->__pyx_v_oi->subpixel_order); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_v_so = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":368
 *             info["timestamp"] = oi.timestamp
 *         so = SUBPIXEL_STR.get(oi.subpixel_order)
 *         if so and so!="unknown":             # <<<<<<<<<<<<<<
 *             info["subpixel-order"] = so
 *         if oi.nclone:
*/
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_so); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 368, __pyx_L1_error)
    if (__pyx_t_10) {
    } else {
      __pyx_t_1 = __pyx_t_10;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_so, __pyx_mstate_global->__pyx_n_u_unknown, Py_NE)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 368, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_10;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "xpra/x11/bindings/randr.pyx":369
 *         so = SUBPIXEL_STR.get(oi.subpixel_order)
 *         if so and so!="unknown":
 *             info["subpixel-order"] = so             # <<<<<<<<<<<<<<
 *         if oi.nclone:
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))
*/
      if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_kp_u_subpixel_order, __pyx_v_so) < 0))) __PYX_ERR(0, 369, __pyx_L1_error)

      /* "xpra/x11/bindings/randr.pyx":368
 *             info["timestamp"] = oi.timestamp
 *         so = SUBPIXEL_STR.get(oi.subpixel_order)
 *         if so and so!="unknown":             # <<<<<<<<<<<<<<
 *             info["subpixel-order"] = so
 *         if oi.nclone:
*/
    }

    /* "xpra/x11/bindings/randr.pyx":370
 *         if so and so!="unknown":
 *             info["subpixel-order"] = so
 *         if oi.nclone:             # <<<<<<<<<<<<<<
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))
 *         info["properties"] = get_output_properties(display, output)
*/
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_oi->nclone != 0);
    if (__pyx_t_1) {

      /* "xpra/x11/bindings/randr.pyx":371
 *             info["subpixel-order"] = so
 *         if oi.nclone:
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))             # <<<<<<<<<<<<<<
 *         info["properties"] = get_output_properties(display, output)
 *     if oi.name and oi.nameLen:
*/
      __pyx_t_3 = __pyx_pf_4xpra_3x11_8bindings_5randr_15get_output_info_genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_oi->nclone); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PySequence_Tuple(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_clones, __pyx_t_3) < 0))) __PYX_ERR(0, 371, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "xpra/x11/bindings/randr.pyx":370
 *         if so and so!="unknown":
 *             info["subpixel-order"] = so
 *         if oi.nclone:             # <<<<<<<<<<<<<<
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))
 *         info["properties"] = get_output_properties(display, output)
*/
    }

    /* "xpra/x11/bindings/randr.pyx":372
 *         if oi.nclone:
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))
 *         info["properties"] = get_output_properties(display, output)             # <<<<<<<<<<<<<<
 *     if oi.name and oi.nameLen:
 *         info["name"] = s(oi.name[:oi.nameLen])
*/
    __pyx_t_3 = __pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties(__pyx_v_display, __pyx_v_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_properties, __pyx_t_3) < 0))) __PYX_ERR(0, 372, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":359
 *         "connection"        : CONNECTION_STR.get(oi.connection, "%i" % oi.connection),
 *         }
 *     if oi.connection!=RR_Disconnected:             # <<<<<<<<<<<<<<
 *         info |= {
 *             "width-mm"          : oi.mm_width,
*/
  }

  /* "xpra/x11/bindings/randr.pyx":373
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))
 *         info["properties"] = get_output_properties(display, output)
 *     if oi.name and oi.nameLen:             # <<<<<<<<<<<<<<
 *         info["name"] = s(oi.name[:oi.nameLen])
 *     XRRFreeOutputInfo(oi)
*/
  __pyx_t_10 = (__pyx_cur_scope->__pyx_v_oi->name != 0);
  if (__pyx_t_10) {
  } else {
    __pyx_t_1 = __pyx_t_10;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_10 = (__pyx_cur_scope->__pyx_v_oi->nameLen != 0);
  __pyx_t_1 = __pyx_t_10;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":374
 *         info["properties"] = get_output_properties(display, output)
 *     if oi.name and oi.nameLen:
 *         info["name"] = s(oi.name[:oi.nameLen])             # <<<<<<<<<<<<<<
 *     XRRFreeOutputInfo(oi)
 *     return info
*/
    __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_cur_scope->__pyx_v_oi->name + 0, __pyx_cur_scope->__pyx_v_oi->nameLen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __Pyx_PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error)
    __pyx_t_8 = __pyx_f_4xpra_3x11_8bindings_5randr_s(__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_name, __pyx_t_8) < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "xpra/x11/bindings/randr.pyx":373
 *             info["clones"] = tuple(int(oi.clones[i] for i in range(oi.nclone)))
 *         info["properties"] = get_output_properties(display, output)
 *     if oi.name and oi.nameLen:             # <<<<<<<<<<<<<<
 *         info["name"] = s(oi.name[:oi.nameLen])
 *     XRRFreeOutputInfo(oi)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":375
 *     if oi.name and oi.nameLen:
 *         info["name"] = s(oi.name[:oi.nameLen])
 *     XRRFreeOutputInfo(oi)             # <<<<<<<<<<<<<<
 *     return info
 * 
*/
  XRRFreeOutputInfo(__pyx_cur_scope->__pyx_v_oi);

  /* "xpra/x11/bindings/randr.pyx":376
 *         info["name"] = s(oi.name[:oi.nameLen])
 *     XRRFreeOutputInfo(oi)
 *     return info             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_info);
  __pyx_r = __pyx_v_info;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":351
 * 
 * 
 * cdef dict get_output_info(Display *display, XRRScreenResources *rsc, RROutput output):             # <<<<<<<<<<<<<<
 *     cdef XRROutputInfo *oi = XRRGetOutputInfo(display, rsc, output)
 *     if oi==NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_output_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_v_so);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_15get_output_info_2generator1);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":379
 * 
 * 
 * cdef str get_XAtom(Display *display, Atom atom):             # <<<<<<<<<<<<<<
 *     cdef char *v = XGetAtomName(display, atom)
 *     if v == NULL:
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_XAtom(Display *__pyx_v_display, __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_v_atom) {
  char *__pyx_v_v;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_XAtom", 0);

  /* "xpra/x11/bindings/randr.pyx":380
 * 
 * cdef str get_XAtom(Display *display, Atom atom):
 *     cdef char *v = XGetAtomName(display, atom)             # <<<<<<<<<<<<<<
 *     if v == NULL:
 *         return ""
*/
  __pyx_v_v = XGetAtomName(__pyx_v_display, __pyx_v_atom);

  /* "xpra/x11/bindings/randr.pyx":381
 * cdef str get_XAtom(Display *display, Atom atom):
 *     cdef char *v = XGetAtomName(display, atom)
 *     if v == NULL:             # <<<<<<<<<<<<<<
 *         return ""
 *     r = v[:]
*/
  __pyx_t_1 = (__pyx_v_v == NULL);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":382
 *     cdef char *v = XGetAtomName(display, atom)
 *     if v == NULL:
 *         return ""             # <<<<<<<<<<<<<<
 *     r = v[:]
 *     XFree(v)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u_;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":381
 * cdef str get_XAtom(Display *display, Atom atom):
 *     cdef char *v = XGetAtomName(display, atom)
 *     if v == NULL:             # <<<<<<<<<<<<<<
 *         return ""
 *     r = v[:]
*/
  }

  /* "xpra/x11/bindings/randr.pyx":383
 *     if v == NULL:
 *         return ""
 *     r = v[:]             # <<<<<<<<<<<<<<
 *     XFree(v)
 *     return r.decode()
*/
  __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_v + 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":384
 *         return ""
 *     r = v[:]
 *     XFree(v)             # <<<<<<<<<<<<<<
 *     return r.decode()
 * 
*/
  (void)(XFree(__pyx_v_v));

  /* "xpra/x11/bindings/randr.pyx":385
 *     r = v[:]
 *     XFree(v)
 *     return r.decode()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_decode_bytes(__pyx_v_r, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":379
 * 
 * 
 * cdef str get_XAtom(Display *display, Atom atom):             # <<<<<<<<<<<<<<
 *     cdef char *v = XGetAtomName(display, atom)
 *     if v == NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_XAtom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":388
 * 
 * 
 * cdef str s(const char *v):             # <<<<<<<<<<<<<<
 *     pytmp = v[:]
 *     try:
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_s(char const *__pyx_v_v) {
  PyObject *__pyx_v_pytmp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("s", 0);

  /* "xpra/x11/bindings/randr.pyx":389
 * 
 * cdef str s(const char *v):
 *     pytmp = v[:]             # <<<<<<<<<<<<<<
 *     try:
 *         return pytmp.decode()
*/
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_v + 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pytmp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":390
 * cdef str s(const char *v):
 *     pytmp = v[:]
 *     try:             # <<<<<<<<<<<<<<
 *         return pytmp.decode()
 *     except:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "xpra/x11/bindings/randr.pyx":391
 *     pytmp = v[:]
 *     try:
 *         return pytmp.decode()             # <<<<<<<<<<<<<<
 *     except:
 *         return str(v[:])
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_pytmp, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L7_try_return;

      /* "xpra/x11/bindings/randr.pyx":390
 * cdef str s(const char *v):
 *     pytmp = v[:]
 *     try:             # <<<<<<<<<<<<<<
 *         return pytmp.decode()
 *     except:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":392
 *     try:
 *         return pytmp.decode()
 *     except:             # <<<<<<<<<<<<<<
 *         return str(v[:])
 * 
*/
    /*except:*/ {
      __Pyx_AddTraceback("xpra.x11.bindings.randr.s", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 392, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "xpra/x11/bindings/randr.pyx":393
 *         return pytmp.decode()
 *     except:
 *         return str(v[:])             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_v + 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_Unicode(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 393, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_r = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }

    /* "xpra/x11/bindings/randr.pyx":390
 * cdef str s(const char *v):
 *     pytmp = v[:]
 *     try:             # <<<<<<<<<<<<<<
 *         return pytmp.decode()
 *     except:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "xpra/x11/bindings/randr.pyx":388
 * 
 * 
 * cdef str s(const char *v):             # <<<<<<<<<<<<<<
 *     pytmp = v[:]
 *     try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pytmp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_21get_output_properties_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":448
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)
 *             if at=="ATOM":
 *                 value = tuple(get_XAtom(display, v) for v in value)             # <<<<<<<<<<<<<<
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:
 *                 #EDID is a binary blob:
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21get_output_properties_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 448, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_21get_output_properties_2generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_output_properties_locals_gen, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 448, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_output_properties.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_21get_output_properties_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 448, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 448, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 448, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 448, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 448, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyLong_As_unsigned_long(__pyx_cur_scope->__pyx_v_v); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 448, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_4xpra_3x11_8bindings_5randr_get_XAtom(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_display, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 448, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":396
 * 
 * 
 * cdef dict get_output_properties(Display *display, RROutput output):             # <<<<<<<<<<<<<<
 *     cdef int nprop
 *     cdef Atom *atoms = XRRListOutputProperties(display, output, &nprop)
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties(Display *__pyx_v_display, RROutput __pyx_v_output) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties *__pyx_cur_scope;
  int __pyx_v_nprop;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom *__pyx_v_atoms;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_v_prop;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_v_actual_type;
  int __pyx_v_actual_format;
  unsigned long __pyx_v_nitems;
  unsigned long __pyx_v_bytes_after;
  unsigned char *__pyx_v_buf;
  int __pyx_v_nbytes;
  XRRPropertyInfo *__pyx_v_prop_info;
  PyObject *__pyx_v_properties = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_prop_name = NULL;
  int __pyx_v_r;
  PyObject *__pyx_v_at = NULL;
  PyObject *__pyx_v_fmt = NULL;
  PyObject *__pyx_v_bytes_per_item = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_parse_edid = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_21get_output_properties_2generator2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[4];
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15[5];
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  Py_ssize_t __pyx_t_25;
  PyObject *__pyx_t_26 = NULL;
  int __pyx_t_27;
  char const *__pyx_t_28;
  PyObject *__pyx_t_29 = NULL;
  PyObject *__pyx_t_30 = NULL;
  PyObject *__pyx_t_31 = NULL;
  PyObject *__pyx_t_32 = NULL;
  PyObject *__pyx_t_33 = NULL;
  char const *__pyx_t_34;
  long __pyx_t_35;
  int __pyx_t_36;
  PyObject *__pyx_t_37 = NULL;
  PyObject *__pyx_t_38[6];
  PyObject *__pyx_t_39 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_output_properties", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 396, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_display = __pyx_v_display;

  /* "xpra/x11/bindings/randr.pyx":398
 * cdef dict get_output_properties(Display *display, RROutput output):
 *     cdef int nprop
 *     cdef Atom *atoms = XRRListOutputProperties(display, output, &nprop)             # <<<<<<<<<<<<<<
 *     cdef Atom prop, actual_type
 *     cdef int actual_format
*/
  __pyx_v_atoms = XRRListOutputProperties(__pyx_cur_scope->__pyx_v_display, __pyx_v_output, (&__pyx_v_nprop));

  /* "xpra/x11/bindings/randr.pyx":406
 *     cdef int nbytes
 *     cdef XRRPropertyInfo *prop_info
 *     log(f"reading {nprop} properties from output {output}")             # <<<<<<<<<<<<<<
 *     properties = {}
 *     for i in range(nprop):
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_nprop, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyUnicode_From_RROutput(__pyx_v_output, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_reading;
  __pyx_t_6[1] = __pyx_t_4;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_properties_from_output;
  __pyx_t_6[3] = __pyx_t_5;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 4, 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127);
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":407
 *     cdef XRRPropertyInfo *prop_info
 *     log(f"reading {nprop} properties from output {output}")
 *     properties = {}             # <<<<<<<<<<<<<<
 *     for i in range(nprop):
 *         prop = atoms[i]
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_properties = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":408
 *     log(f"reading {nprop} properties from output {output}")
 *     properties = {}
 *     for i in range(nprop):             # <<<<<<<<<<<<<<
 *         prop = atoms[i]
 *         prop_name = get_XAtom(display, prop)
*/
  __pyx_t_9 = __pyx_v_nprop;
  __pyx_t_10 = __pyx_t_9;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "xpra/x11/bindings/randr.pyx":409
 *     properties = {}
 *     for i in range(nprop):
 *         prop = atoms[i]             # <<<<<<<<<<<<<<
 *         prop_name = get_XAtom(display, prop)
 *         buf = NULL
*/
    __pyx_v_prop = (__pyx_v_atoms[__pyx_v_i]);

    /* "xpra/x11/bindings/randr.pyx":410
 *     for i in range(nprop):
 *         prop = atoms[i]
 *         prop_name = get_XAtom(display, prop)             # <<<<<<<<<<<<<<
 *         buf = NULL
 *         r = XRRGetOutputProperty(display, output,
*/
    __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_get_XAtom(__pyx_cur_scope->__pyx_v_display, __pyx_v_prop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_prop_name, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":411
 *         prop = atoms[i]
 *         prop_name = get_XAtom(display, prop)
 *         buf = NULL             # <<<<<<<<<<<<<<
 *         r = XRRGetOutputProperty(display, output,
 *                                  prop, 0, 1024,
*/
    __pyx_v_buf = NULL;

    /* "xpra/x11/bindings/randr.pyx":412
 *         prop_name = get_XAtom(display, prop)
 *         buf = NULL
 *         r = XRRGetOutputProperty(display, output,             # <<<<<<<<<<<<<<
 *                                  prop, 0, 1024,
 *                                  0, 0, AnyPropertyType,
*/
    __pyx_v_r = XRRGetOutputProperty(__pyx_cur_scope->__pyx_v_display, __pyx_v_output, __pyx_v_prop, 0, 0x400, 0, 0, AnyPropertyType, (&__pyx_v_actual_type), (&__pyx_v_actual_format), (&__pyx_v_nitems), (&__pyx_v_bytes_after), (&__pyx_v_buf));

    /* "xpra/x11/bindings/randr.pyx":418
 *                                  &nitems, &bytes_after,
 *                                  &buf)
 *         if r or not buf:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             continue
*/
    __pyx_t_13 = (__pyx_v_r != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_13 = (!(__pyx_v_buf != 0));
    __pyx_t_12 = __pyx_t_13;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_12) {

      /* "xpra/x11/bindings/randr.pyx":419
 *                                  &buf)
 *         if r or not buf:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")             # <<<<<<<<<<<<<<
 *             continue
 *         if bytes_after:
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_prop_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Warning_failed_to_read_output_pr, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":420
 *         if r or not buf:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             continue             # <<<<<<<<<<<<<<
 *         if bytes_after:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
*/
      goto __pyx_L3_continue;

      /* "xpra/x11/bindings/randr.pyx":418
 *                                  &nitems, &bytes_after,
 *                                  &buf)
 *         if r or not buf:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             continue
*/
    }

    /* "xpra/x11/bindings/randr.pyx":421
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             continue
 *         if bytes_after:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" data too large")
*/
    __pyx_t_12 = (__pyx_v_bytes_after != 0);
    if (__pyx_t_12) {

      /* "xpra/x11/bindings/randr.pyx":422
 *             continue
 *         if bytes_after:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")             # <<<<<<<<<<<<<<
 *             log.warn(" data too large")
 *             continue
*/
      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_prop_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Warning_failed_to_read_output_pr, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":423
 *         if bytes_after:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" data too large")             # <<<<<<<<<<<<<<
 *             continue
 *         if not actual_format:
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_data_too_large};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":424
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" data too large")
 *             continue             # <<<<<<<<<<<<<<
 *         if not actual_format:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
*/
      goto __pyx_L3_continue;

      /* "xpra/x11/bindings/randr.pyx":421
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             continue
 *         if bytes_after:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" data too large")
*/
    }

    /* "xpra/x11/bindings/randr.pyx":425
 *             log.warn(" data too large")
 *             continue
 *         if not actual_format:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" invalid format")
*/
    __pyx_t_12 = (!(__pyx_v_actual_format != 0));
    if (__pyx_t_12) {

      /* "xpra/x11/bindings/randr.pyx":426
 *             continue
 *         if not actual_format:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")             # <<<<<<<<<<<<<<
 *             log.warn(" invalid format")
 *             continue
*/
      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_prop_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Warning_failed_to_read_output_pr, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":427
 *         if not actual_format:
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" invalid format")             # <<<<<<<<<<<<<<
 *             continue
 *         at = get_XAtom(display, actual_type)
*/
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_invalid_format};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":428
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" invalid format")
 *             continue             # <<<<<<<<<<<<<<
 *         at = get_XAtom(display, actual_type)
 *         if at not in ("INTEGER", "CARDINAL", "ATOM"):
*/
      goto __pyx_L3_continue;

      /* "xpra/x11/bindings/randr.pyx":425
 *             log.warn(" data too large")
 *             continue
 *         if not actual_format:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: failed to read output property {prop_name!r}")
 *             log.warn(" invalid format")
*/
    }

    /* "xpra/x11/bindings/randr.pyx":429
 *             log.warn(" invalid format")
 *             continue
 *         at = get_XAtom(display, actual_type)             # <<<<<<<<<<<<<<
 *         if at not in ("INTEGER", "CARDINAL", "ATOM"):
 *             log(f"skipped output property {at}")
*/
    __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_get_XAtom(__pyx_cur_scope->__pyx_v_display, __pyx_v_actual_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_at, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":430
 *             continue
 *         at = get_XAtom(display, actual_type)
 *         if at not in ("INTEGER", "CARDINAL", "ATOM"):             # <<<<<<<<<<<<<<
 *             log(f"skipped output property {at}")
 *             continue
*/
    __Pyx_INCREF(__pyx_v_at);
    __pyx_t_14 = __pyx_v_at;
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_INTEGER, Py_NE)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 430, __pyx_L1_error)
    if (__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_CARDINAL, Py_NE)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 430, __pyx_L1_error)
    if (__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_ATOM, Py_NE)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 430, __pyx_L1_error)
    __pyx_t_12 = __pyx_t_13;
    __pyx_L11_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_13 = __pyx_t_12;
    if (__pyx_t_13) {

      /* "xpra/x11/bindings/randr.pyx":431
 *         at = get_XAtom(display, actual_type)
 *         if at not in ("INTEGER", "CARDINAL", "ATOM"):
 *             log(f"skipped output property {at}")             # <<<<<<<<<<<<<<
 *             continue
 *         if actual_format == 8:
*/
      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_at); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_skipped_output_property, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":432
 *         if at not in ("INTEGER", "CARDINAL", "ATOM"):
 *             log(f"skipped output property {at}")
 *             continue             # <<<<<<<<<<<<<<
 *         if actual_format == 8:
 *             fmt = b"B"
*/
      goto __pyx_L3_continue;

      /* "xpra/x11/bindings/randr.pyx":430
 *             continue
 *         at = get_XAtom(display, actual_type)
 *         if at not in ("INTEGER", "CARDINAL", "ATOM"):             # <<<<<<<<<<<<<<
 *             log(f"skipped output property {at}")
 *             continue
*/
    }

    /* "xpra/x11/bindings/randr.pyx":433
 *             log(f"skipped output property {at}")
 *             continue
 *         if actual_format == 8:             # <<<<<<<<<<<<<<
 *             fmt = b"B"
 *         elif actual_format == 16:
*/
    switch (__pyx_v_actual_format) {
      case 8:

      /* "xpra/x11/bindings/randr.pyx":434
 *             continue
 *         if actual_format == 8:
 *             fmt = b"B"             # <<<<<<<<<<<<<<
 *         elif actual_format == 16:
 *             fmt = b"H"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_B);
      __Pyx_XDECREF_SET(__pyx_v_fmt, __pyx_mstate_global->__pyx_n_b_B);

      /* "xpra/x11/bindings/randr.pyx":433
 *             log(f"skipped output property {at}")
 *             continue
 *         if actual_format == 8:             # <<<<<<<<<<<<<<
 *             fmt = b"B"
 *         elif actual_format == 16:
*/
      break;
      case 16:

      /* "xpra/x11/bindings/randr.pyx":436
 *             fmt = b"B"
 *         elif actual_format == 16:
 *             fmt = b"H"             # <<<<<<<<<<<<<<
 *         elif actual_format == 32:
 *             fmt = b"L"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_H);
      __Pyx_XDECREF_SET(__pyx_v_fmt, __pyx_mstate_global->__pyx_n_b_H);

      /* "xpra/x11/bindings/randr.pyx":435
 *         if actual_format == 8:
 *             fmt = b"B"
 *         elif actual_format == 16:             # <<<<<<<<<<<<<<
 *             fmt = b"H"
 *         elif actual_format == 32:
*/
      break;
      case 32:

      /* "xpra/x11/bindings/randr.pyx":438
 *             fmt = b"H"
 *         elif actual_format == 32:
 *             fmt = b"L"             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(f"invalid format {actual_format}")
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_L);
      __Pyx_XDECREF_SET(__pyx_v_fmt, __pyx_mstate_global->__pyx_n_b_L);

      /* "xpra/x11/bindings/randr.pyx":437
 *         elif actual_format == 16:
 *             fmt = b"H"
 *         elif actual_format == 32:             # <<<<<<<<<<<<<<
 *             fmt = b"L"
 *         else:
*/
      break;
      default:

      /* "xpra/x11/bindings/randr.pyx":440
 *             fmt = b"L"
 *         else:
 *             raise ValueError(f"invalid format {actual_format}")             # <<<<<<<<<<<<<<
 *         log(f"{prop_name!r} : {at} / {actual_format}")
 *         try:
*/
      __pyx_t_7 = NULL;
      __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_actual_format, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_invalid_format_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 440, __pyx_L1_error)
      break;
    }

    /* "xpra/x11/bindings/randr.pyx":441
 *         else:
 *             raise ValueError(f"invalid format {actual_format}")
 *         log(f"{prop_name!r} : {at} / {actual_format}")             # <<<<<<<<<<<<<<
 *         try:
 *             bytes_per_item = struct.calcsize(b"@%s" % fmt)
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_prop_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_at); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_actual_format, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15[0] = __pyx_t_3;
    __pyx_t_15[1] = __pyx_mstate_global->__pyx_kp_u__2;
    __pyx_t_15[2] = __pyx_t_5;
    __pyx_t_15[3] = __pyx_mstate_global->__pyx_kp_u__3;
    __pyx_t_15[4] = __pyx_t_4;
    __pyx_t_16 = __Pyx_PyUnicode_Join(__pyx_t_15, 5, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 3 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_16};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":442
 *             raise ValueError(f"invalid format {actual_format}")
 *         log(f"{prop_name!r} : {at} / {actual_format}")
 *         try:             # <<<<<<<<<<<<<<
 *             bytes_per_item = struct.calcsize(b"@%s" % fmt)
 *             nbytes = bytes_per_item * nitems
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      /*try:*/ {

        /* "xpra/x11/bindings/randr.pyx":443
 *         log(f"{prop_name!r} : {at} / {actual_format}")
 *         try:
 *             bytes_per_item = struct.calcsize(b"@%s" % fmt)             # <<<<<<<<<<<<<<
 *             nbytes = bytes_per_item * nitems
 *             data = buf[:nbytes]
*/
        __pyx_t_7 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_struct); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 443, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_calcsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = PyNumber_Remainder(__pyx_mstate_global->__pyx_kp_b_s, __pyx_v_fmt); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 443, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_8 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
          assert(__pyx_t_7);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
          __pyx_t_8 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_16};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_v_bytes_per_item, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":444
 *         try:
 *             bytes_per_item = struct.calcsize(b"@%s" % fmt)
 *             nbytes = bytes_per_item * nitems             # <<<<<<<<<<<<<<
 *             data = buf[:nbytes]
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)
*/
        __pyx_t_1 = __Pyx_PyLong_From_unsigned_long(__pyx_v_nitems); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyNumber_Multiply(__pyx_v_bytes_per_item, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_20 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_nbytes = __pyx_t_20;

        /* "xpra/x11/bindings/randr.pyx":445
 *             bytes_per_item = struct.calcsize(b"@%s" % fmt)
 *             nbytes = bytes_per_item * nitems
 *             data = buf[:nbytes]             # <<<<<<<<<<<<<<
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)
 *             if at=="ATOM":
*/
        __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_buf) + 0, __pyx_v_nbytes - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_data, ((PyObject*)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":446
 *             nbytes = bytes_per_item * nitems
 *             data = buf[:nbytes]
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)             # <<<<<<<<<<<<<<
 *             if at=="ATOM":
 *                 value = tuple(get_XAtom(display, v) for v in value)
*/
        __pyx_t_1 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_struct); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 446, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_unpack); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 446, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = __Pyx_PySequence_Multiply(__pyx_v_fmt, __pyx_v_nitems); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 446, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_4 = PyNumber_Remainder(__pyx_mstate_global->__pyx_kp_b_s, __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_8 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
          assert(__pyx_t_1);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
          __pyx_t_8 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_4, __pyx_v_data};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":447
 *             data = buf[:nbytes]
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)
 *             if at=="ATOM":             # <<<<<<<<<<<<<<
 *                 value = tuple(get_XAtom(display, v) for v in value)
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:
*/
        __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_at, __pyx_mstate_global->__pyx_n_u_ATOM, Py_EQ)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 447, __pyx_L14_error)
        if (__pyx_t_13) {

          /* "xpra/x11/bindings/randr.pyx":448
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)
 *             if at=="ATOM":
 *                 value = tuple(get_XAtom(display, v) for v in value)             # <<<<<<<<<<<<<<
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:
 *                 #EDID is a binary blob:
*/
          __pyx_t_2 = __pyx_pf_4xpra_3x11_8bindings_5randr_21get_output_properties_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "xpra/x11/bindings/randr.pyx":447
 *             data = buf[:nbytes]
 *             value = struct.unpack(b"@%s" % (fmt*nitems), data)
 *             if at=="ATOM":             # <<<<<<<<<<<<<<
 *                 value = tuple(get_XAtom(display, v) for v in value)
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:
*/
        }

        /* "xpra/x11/bindings/randr.pyx":449
 *             if at=="ATOM":
 *                 value = tuple(get_XAtom(display, v) for v in value)
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:             # <<<<<<<<<<<<<<
 *                 #EDID is a binary blob:
 *                 value = bytes(value)
*/
        __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_at, __pyx_mstate_global->__pyx_n_u_INTEGER, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 449, __pyx_L14_error)
        if (__pyx_t_12) {
        } else {
          __pyx_t_13 = __pyx_t_12;
          goto __pyx_L24_bool_binop_done;
        }
        __pyx_t_12 = (__pyx_v_actual_format == 8);
        if (__pyx_t_12) {
        } else {
          __pyx_t_13 = __pyx_t_12;
          goto __pyx_L24_bool_binop_done;
        }
        __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_prop_name, __pyx_mstate_global->__pyx_n_u_EDID, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 449, __pyx_L14_error)
        if (__pyx_t_12) {
        } else {
          __pyx_t_13 = __pyx_t_12;
          goto __pyx_L24_bool_binop_done;
        }
        __pyx_t_12 = (__pyx_v_nitems >= 32);
        __pyx_t_13 = __pyx_t_12;
        __pyx_L24_bool_binop_done:;
        if (__pyx_t_13) {

          /* "xpra/x11/bindings/randr.pyx":451
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:
 *                 #EDID is a binary blob:
 *                 value = bytes(value)             # <<<<<<<<<<<<<<
 *                 try:
 *                     from pyedid import parse_edid
*/
          __pyx_t_2 = NULL;
          __pyx_t_8 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_value};
            __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "xpra/x11/bindings/randr.pyx":452
 *                 #EDID is a binary blob:
 *                 value = bytes(value)
 *                 try:             # <<<<<<<<<<<<<<
 *                     from pyedid import parse_edid
 *                     value = parse_edid(value)._asdict()
*/
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __Pyx_ExceptionSave(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
            __Pyx_XGOTREF(__pyx_t_21);
            __Pyx_XGOTREF(__pyx_t_22);
            __Pyx_XGOTREF(__pyx_t_23);
            /*try:*/ {

              /* "xpra/x11/bindings/randr.pyx":453
 *                 value = bytes(value)
 *                 try:
 *                     from pyedid import parse_edid             # <<<<<<<<<<<<<<
 *                     value = parse_edid(value)._asdict()
 *                 except ImportError as e:
*/
              {
                PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_parse_edid};
                __pyx_t_24 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pyedid, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 453, __pyx_L28_error)
              }
              __pyx_t_7 = __pyx_t_24;
              __Pyx_GOTREF(__pyx_t_7);
              {
                PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_parse_edid};
                __pyx_t_25 = 0; {
                  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_imported_names[__pyx_t_25]); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L28_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  switch (__pyx_t_25) {
                    case 0:
                    __Pyx_INCREF(__pyx_t_2);
                    __Pyx_XDECREF_SET(__pyx_v_parse_edid, __pyx_t_2);
                    break;
                    default:;
                  }
                  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                }
              }
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

              /* "xpra/x11/bindings/randr.pyx":454
 *                 try:
 *                     from pyedid import parse_edid
 *                     value = parse_edid(value)._asdict()             # <<<<<<<<<<<<<<
 *                 except ImportError as e:
 *                     log(f"cannot parse EDID: {e}")
*/
              __pyx_t_1 = NULL;
              __Pyx_INCREF(__pyx_v_parse_edid);
              __pyx_t_16 = __pyx_v_parse_edid; 
              __pyx_t_8 = 1;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_16))) {
                __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16);
                assert(__pyx_t_1);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_16, __pyx__function);
                __pyx_t_8 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_value};
                __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L28_error)
                __Pyx_GOTREF(__pyx_t_4);
              }
              __pyx_t_2 = __pyx_t_4;
              __Pyx_INCREF(__pyx_t_2);
              __pyx_t_8 = 0;
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
                __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asdict, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 454, __pyx_L28_error)
                __Pyx_GOTREF(__pyx_t_7);
              }
              __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_7);
              __pyx_t_7 = 0;

              /* "xpra/x11/bindings/randr.pyx":452
 *                 #EDID is a binary blob:
 *                 value = bytes(value)
 *                 try:             # <<<<<<<<<<<<<<
 *                     from pyedid import parse_edid
 *                     value = parse_edid(value)._asdict()
*/
            }
            __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
            __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
            __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
            goto __pyx_L35_try_end;
            __pyx_L28_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "xpra/x11/bindings/randr.pyx":455
 *                     from pyedid import parse_edid
 *                     value = parse_edid(value)._asdict()
 *                 except ImportError as e:             # <<<<<<<<<<<<<<
 *                     log(f"cannot parse EDID: {e}")
 *                 except ValueError as e:
*/
            __pyx_t_20 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ImportError))));
            if (__pyx_t_20) {
              __Pyx_AddTraceback("xpra.x11.bindings.randr.get_output_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_2) < 0) __PYX_ERR(0, 455, __pyx_L30_except_error)
              __Pyx_XGOTREF(__pyx_t_7);
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_4);
              /*try:*/ {

                /* "xpra/x11/bindings/randr.pyx":456
 *                     value = parse_edid(value)._asdict()
 *                 except ImportError as e:
 *                     log(f"cannot parse EDID: {e}")             # <<<<<<<<<<<<<<
 *                 except ValueError as e:
 *                     log.warn(f"Warning: invalid EDID data: {e}")
*/
                __pyx_t_1 = NULL;
                __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L41_error)
                __Pyx_GOTREF(__pyx_t_5);
                __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L41_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_26 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_cannot_parse_EDID, __pyx_t_3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 456, __pyx_L41_error)
                __Pyx_GOTREF(__pyx_t_26);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __pyx_t_8 = 1;
                #if CYTHON_UNPACK_METHODS
                if (unlikely(PyMethod_Check(__pyx_t_5))) {
                  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
                  assert(__pyx_t_1);
                  PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
                  __Pyx_INCREF(__pyx_t_1);
                  __Pyx_INCREF(__pyx__function);
                  __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
                  __pyx_t_8 = 0;
                }
                #endif
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_26};
                  __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                  if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 456, __pyx_L41_error)
                  __Pyx_GOTREF(__pyx_t_16);
                }
                __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
              }

              /* "xpra/x11/bindings/randr.pyx":455
 *                     from pyedid import parse_edid
 *                     value = parse_edid(value)._asdict()
 *                 except ImportError as e:             # <<<<<<<<<<<<<<
 *                     log(f"cannot parse EDID: {e}")
 *                 except ValueError as e:
*/
              /*finally:*/ {
                /*normal exit:*/{
                  __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                  goto __pyx_L42;
                }
                __pyx_L41_error:;
                /*exception exit:*/{
                  __Pyx_PyThreadState_declare
                  __Pyx_PyThreadState_assign
                  __pyx_t_24 = 0; __pyx_t_29 = 0; __pyx_t_30 = 0; __pyx_t_31 = 0; __pyx_t_32 = 0; __pyx_t_33 = 0;
                  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                  __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
                  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                   __Pyx_ExceptionSwap(&__pyx_t_31, &__pyx_t_32, &__pyx_t_33);
                  if ( unlikely(__Pyx_GetException(&__pyx_t_24, &__pyx_t_29, &__pyx_t_30) < 0)) __Pyx_ErrFetch(&__pyx_t_24, &__pyx_t_29, &__pyx_t_30);
                  __Pyx_XGOTREF(__pyx_t_24);
                  __Pyx_XGOTREF(__pyx_t_29);
                  __Pyx_XGOTREF(__pyx_t_30);
                  __Pyx_XGOTREF(__pyx_t_31);
                  __Pyx_XGOTREF(__pyx_t_32);
                  __Pyx_XGOTREF(__pyx_t_33);
                  __pyx_t_20 = __pyx_lineno; __pyx_t_27 = __pyx_clineno; __pyx_t_28 = __pyx_filename;
                  {
                    __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                  }
                  __Pyx_XGIVEREF(__pyx_t_31);
                  __Pyx_XGIVEREF(__pyx_t_32);
                  __Pyx_XGIVEREF(__pyx_t_33);
                  __Pyx_ExceptionReset(__pyx_t_31, __pyx_t_32, __pyx_t_33);
                  __Pyx_XGIVEREF(__pyx_t_24);
                  __Pyx_XGIVEREF(__pyx_t_29);
                  __Pyx_XGIVEREF(__pyx_t_30);
                  __Pyx_ErrRestore(__pyx_t_24, __pyx_t_29, __pyx_t_30);
                  __pyx_t_24 = 0; __pyx_t_29 = 0; __pyx_t_30 = 0; __pyx_t_31 = 0; __pyx_t_32 = 0; __pyx_t_33 = 0;
                  __pyx_lineno = __pyx_t_20; __pyx_clineno = __pyx_t_27; __pyx_filename = __pyx_t_28;
                  goto __pyx_L30_except_error;
                }
                __pyx_L42:;
              }
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              goto __pyx_L29_exception_handled;
            }

            /* "xpra/x11/bindings/randr.pyx":457
 *                 except ImportError as e:
 *                     log(f"cannot parse EDID: {e}")
 *                 except ValueError as e:             # <<<<<<<<<<<<<<
 *                     log.warn(f"Warning: invalid EDID data: {e}")
 *             if nitems==1:
*/
            __pyx_t_27 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ValueError))));
            if (__pyx_t_27) {
              __Pyx_AddTraceback("xpra.x11.bindings.randr.get_output_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 457, __pyx_L30_except_error)
              __Pyx_XGOTREF(__pyx_t_2);
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_4);
              /*try:*/ {

                /* "xpra/x11/bindings/randr.pyx":458
 *                     log(f"cannot parse EDID: {e}")
 *                 except ValueError as e:
 *                     log.warn(f"Warning: invalid EDID data: {e}")             # <<<<<<<<<<<<<<
 *             if nitems==1:
 *                 value = value[0]
*/
                __pyx_t_5 = NULL;
                __Pyx_GetModuleGlobalName(__pyx_t_26, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 458, __pyx_L52_error)
                __Pyx_GOTREF(__pyx_t_26);
                __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_26, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L52_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
                __pyx_t_26 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 458, __pyx_L52_error)
                __Pyx_GOTREF(__pyx_t_26);
                __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Warning_invalid_EDID_data, __pyx_t_26); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L52_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
                __pyx_t_8 = 1;
                #if CYTHON_UNPACK_METHODS
                if (unlikely(PyMethod_Check(__pyx_t_1))) {
                  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
                  assert(__pyx_t_5);
                  PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
                  __Pyx_INCREF(__pyx_t_5);
                  __Pyx_INCREF(__pyx__function);
                  __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
                  __pyx_t_8 = 0;
                }
                #endif
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3};
                  __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 458, __pyx_L52_error)
                  __Pyx_GOTREF(__pyx_t_16);
                }
                __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
              }

              /* "xpra/x11/bindings/randr.pyx":457
 *                 except ImportError as e:
 *                     log(f"cannot parse EDID: {e}")
 *                 except ValueError as e:             # <<<<<<<<<<<<<<
 *                     log.warn(f"Warning: invalid EDID data: {e}")
 *             if nitems==1:
*/
              /*finally:*/ {
                /*normal exit:*/{
                  __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                  goto __pyx_L53;
                }
                __pyx_L52_error:;
                /*exception exit:*/{
                  __Pyx_PyThreadState_declare
                  __Pyx_PyThreadState_assign
                  __pyx_t_33 = 0; __pyx_t_32 = 0; __pyx_t_31 = 0; __pyx_t_30 = 0; __pyx_t_29 = 0; __pyx_t_24 = 0;
                  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                  __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
                  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                   __Pyx_ExceptionSwap(&__pyx_t_30, &__pyx_t_29, &__pyx_t_24);
                  if ( unlikely(__Pyx_GetException(&__pyx_t_33, &__pyx_t_32, &__pyx_t_31) < 0)) __Pyx_ErrFetch(&__pyx_t_33, &__pyx_t_32, &__pyx_t_31);
                  __Pyx_XGOTREF(__pyx_t_33);
                  __Pyx_XGOTREF(__pyx_t_32);
                  __Pyx_XGOTREF(__pyx_t_31);
                  __Pyx_XGOTREF(__pyx_t_30);
                  __Pyx_XGOTREF(__pyx_t_29);
                  __Pyx_XGOTREF(__pyx_t_24);
                  __pyx_t_27 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_34 = __pyx_filename;
                  {
                    __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                  }
                  __Pyx_XGIVEREF(__pyx_t_30);
                  __Pyx_XGIVEREF(__pyx_t_29);
                  __Pyx_XGIVEREF(__pyx_t_24);
                  __Pyx_ExceptionReset(__pyx_t_30, __pyx_t_29, __pyx_t_24);
                  __Pyx_XGIVEREF(__pyx_t_33);
                  __Pyx_XGIVEREF(__pyx_t_32);
                  __Pyx_XGIVEREF(__pyx_t_31);
                  __Pyx_ErrRestore(__pyx_t_33, __pyx_t_32, __pyx_t_31);
                  __pyx_t_33 = 0; __pyx_t_32 = 0; __pyx_t_31 = 0; __pyx_t_30 = 0; __pyx_t_29 = 0; __pyx_t_24 = 0;
                  __pyx_lineno = __pyx_t_27; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_34;
                  goto __pyx_L30_except_error;
                }
                __pyx_L53:;
              }
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              goto __pyx_L29_exception_handled;
            }
            goto __pyx_L30_except_error;

            /* "xpra/x11/bindings/randr.pyx":452
 *                 #EDID is a binary blob:
 *                 value = bytes(value)
 *                 try:             # <<<<<<<<<<<<<<
 *                     from pyedid import parse_edid
 *                     value = parse_edid(value)._asdict()
*/
            __pyx_L30_except_error:;
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_22);
            __Pyx_XGIVEREF(__pyx_t_23);
            __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
            goto __pyx_L14_error;
            __pyx_L29_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_22);
            __Pyx_XGIVEREF(__pyx_t_23);
            __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
            __pyx_L35_try_end:;
          }

          /* "xpra/x11/bindings/randr.pyx":449
 *             if at=="ATOM":
 *                 value = tuple(get_XAtom(display, v) for v in value)
 *             if at=="INTEGER" and actual_format==8 and prop_name=="EDID" and nitems>=32:             # <<<<<<<<<<<<<<
 *                 #EDID is a binary blob:
 *                 value = bytes(value)
*/
        }

        /* "xpra/x11/bindings/randr.pyx":459
 *                 except ValueError as e:
 *                     log.warn(f"Warning: invalid EDID data: {e}")
 *             if nitems==1:             # <<<<<<<<<<<<<<
 *                 value = value[0]
 *                 #convert booleans:
*/
        __pyx_t_13 = (__pyx_v_nitems == 1);
        if (__pyx_t_13) {

          /* "xpra/x11/bindings/randr.pyx":460
 *                     log.warn(f"Warning: invalid EDID data: {e}")
 *             if nitems==1:
 *                 value = value[0]             # <<<<<<<<<<<<<<
 *                 #convert booleans:
 *                 prop_info = XRRQueryOutputProperty(display, output, prop)
*/
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 460, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "xpra/x11/bindings/randr.pyx":462
 *                 value = value[0]
 *                 #convert booleans:
 *                 prop_info = XRRQueryOutputProperty(display, output, prop)             # <<<<<<<<<<<<<<
 *                 if prop_info:
 *                     if prop_info.num_values==2 and prop_info.values[0] in (0, 1) and prop_info.values[1] in (0, 1):
*/
          __pyx_v_prop_info = XRRQueryOutputProperty(__pyx_cur_scope->__pyx_v_display, __pyx_v_output, __pyx_v_prop);

          /* "xpra/x11/bindings/randr.pyx":463
 *                 #convert booleans:
 *                 prop_info = XRRQueryOutputProperty(display, output, prop)
 *                 if prop_info:             # <<<<<<<<<<<<<<
 *                     if prop_info.num_values==2 and prop_info.values[0] in (0, 1) and prop_info.values[1] in (0, 1):
 *                         value = bool(value)
*/
          __pyx_t_13 = (__pyx_v_prop_info != 0);
          if (__pyx_t_13) {

            /* "xpra/x11/bindings/randr.pyx":464
 *                 prop_info = XRRQueryOutputProperty(display, output, prop)
 *                 if prop_info:
 *                     if prop_info.num_values==2 and prop_info.values[0] in (0, 1) and prop_info.values[1] in (0, 1):             # <<<<<<<<<<<<<<
 *                         value = bool(value)
 *                     XFree(prop_info)
*/
            __pyx_t_12 = (__pyx_v_prop_info->num_values == 2);
            if (__pyx_t_12) {
            } else {
              __pyx_t_13 = __pyx_t_12;
              goto __pyx_L61_bool_binop_done;
            }
            __pyx_t_35 = (__pyx_v_prop_info->values[0]);
            __pyx_t_36 = (__pyx_t_35 == 0);
            if (!__pyx_t_36) {
            } else {
              __pyx_t_12 = __pyx_t_36;
              goto __pyx_L64_bool_binop_done;
            }
            __pyx_t_36 = (__pyx_t_35 == 1);
            __pyx_t_12 = __pyx_t_36;
            __pyx_L64_bool_binop_done:;
            __pyx_t_36 = __pyx_t_12;
            if (__pyx_t_36) {
            } else {
              __pyx_t_13 = __pyx_t_36;
              goto __pyx_L61_bool_binop_done;
            }
            __pyx_t_35 = (__pyx_v_prop_info->values[1]);
            __pyx_t_12 = (__pyx_t_35 == 0);
            if (!__pyx_t_12) {
            } else {
              __pyx_t_36 = __pyx_t_12;
              goto __pyx_L66_bool_binop_done;
            }
            __pyx_t_12 = (__pyx_t_35 == 1);
            __pyx_t_36 = __pyx_t_12;
            __pyx_L66_bool_binop_done:;
            __pyx_t_12 = __pyx_t_36;
            __pyx_t_13 = __pyx_t_12;
            __pyx_L61_bool_binop_done:;
            if (__pyx_t_13) {

              /* "xpra/x11/bindings/randr.pyx":465
 *                 if prop_info:
 *                     if prop_info.num_values==2 and prop_info.values[0] in (0, 1) and prop_info.values[1] in (0, 1):
 *                         value = bool(value)             # <<<<<<<<<<<<<<
 *                     XFree(prop_info)
 *         except Exception:
*/
              __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 465, __pyx_L14_error)
              __pyx_t_7 = __Pyx_PyBool_FromLong((!(!__pyx_t_13))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 465, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_7);
              __pyx_t_7 = 0;

              /* "xpra/x11/bindings/randr.pyx":464
 *                 prop_info = XRRQueryOutputProperty(display, output, prop)
 *                 if prop_info:
 *                     if prop_info.num_values==2 and prop_info.values[0] in (0, 1) and prop_info.values[1] in (0, 1):             # <<<<<<<<<<<<<<
 *                         value = bool(value)
 *                     XFree(prop_info)
*/
            }

            /* "xpra/x11/bindings/randr.pyx":466
 *                     if prop_info.num_values==2 and prop_info.values[0] in (0, 1) and prop_info.values[1] in (0, 1):
 *                         value = bool(value)
 *                     XFree(prop_info)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             log.error(f"Error unpacking {prop_name!r} using format {fmt} from {data!r}", exc_info=True)
*/
            (void)(XFree(__pyx_v_prop_info));

            /* "xpra/x11/bindings/randr.pyx":463
 *                 #convert booleans:
 *                 prop_info = XRRQueryOutputProperty(display, output, prop)
 *                 if prop_info:             # <<<<<<<<<<<<<<
 *                     if prop_info.num_values==2 and prop_info.values[0] in (0, 1) and prop_info.values[1] in (0, 1):
 *                         value = bool(value)
*/
          }

          /* "xpra/x11/bindings/randr.pyx":459
 *                 except ValueError as e:
 *                     log.warn(f"Warning: invalid EDID data: {e}")
 *             if nitems==1:             # <<<<<<<<<<<<<<
 *                 value = value[0]
 *                 #convert booleans:
*/
        }

        /* "xpra/x11/bindings/randr.pyx":442
 *             raise ValueError(f"invalid format {actual_format}")
 *         log(f"{prop_name!r} : {at} / {actual_format}")
 *         try:             # <<<<<<<<<<<<<<
 *             bytes_per_item = struct.calcsize(b"@%s" % fmt)
 *             nbytes = bytes_per_item * nitems
*/
      }

      /* "xpra/x11/bindings/randr.pyx":470
 *             log.error(f"Error unpacking {prop_name!r} using format {fmt} from {data!r}", exc_info=True)
 *         else:
 *             if prop_name=="non-desktop" and value is False:             # <<<<<<<<<<<<<<
 *                 #no value in reporting this, we can assume it is False when missing
 *                 continue
*/
      /*else:*/ {
        __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_prop_name, __pyx_mstate_global->__pyx_kp_u_non_desktop, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 470, __pyx_L16_except_error)
        if (__pyx_t_12) {
        } else {
          __pyx_t_13 = __pyx_t_12;
          goto __pyx_L69_bool_binop_done;
        }
        __pyx_t_12 = (__pyx_v_value == Py_False);
        __pyx_t_13 = __pyx_t_12;
        __pyx_L69_bool_binop_done:;
        if (__pyx_t_13) {

          /* "xpra/x11/bindings/randr.pyx":472
 *             if prop_name=="non-desktop" and value is False:
 *                 #no value in reporting this, we can assume it is False when missing
 *                 continue             # <<<<<<<<<<<<<<
 *             properties[prop_name] = value
 *     XFree(atoms)
*/
          goto __pyx_L20_try_continue;

          /* "xpra/x11/bindings/randr.pyx":470
 *             log.error(f"Error unpacking {prop_name!r} using format {fmt} from {data!r}", exc_info=True)
 *         else:
 *             if prop_name=="non-desktop" and value is False:             # <<<<<<<<<<<<<<
 *                 #no value in reporting this, we can assume it is False when missing
 *                 continue
*/
        }

        /* "xpra/x11/bindings/randr.pyx":473
 *                 #no value in reporting this, we can assume it is False when missing
 *                 continue
 *             properties[prop_name] = value             # <<<<<<<<<<<<<<
 *     XFree(atoms)
 *     return properties
*/
        if (unlikely((PyDict_SetItem(__pyx_v_properties, __pyx_v_prop_name, __pyx_v_value) < 0))) __PYX_ERR(0, 473, __pyx_L16_except_error)
      }
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
      goto __pyx_L21_try_end;
      __pyx_L14_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "xpra/x11/bindings/randr.pyx":467
 *                         value = bool(value)
 *                     XFree(prop_info)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.error(f"Error unpacking {prop_name!r} using format {fmt} from {data!r}", exc_info=True)
 *         else:
*/
      __pyx_t_20 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
      if (__pyx_t_20) {
        __Pyx_AddTraceback("xpra.x11.bindings.randr.get_output_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_2) < 0) __PYX_ERR(0, 467, __pyx_L16_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_2);

        /* "xpra/x11/bindings/randr.pyx":468
 *                     XFree(prop_info)
 *         except Exception:
 *             log.error(f"Error unpacking {prop_name!r} using format {fmt} from {data!r}", exc_info=True)             # <<<<<<<<<<<<<<
 *         else:
 *             if prop_name=="non-desktop" and value is False:
*/
        __pyx_t_1 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 468, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_prop_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_26 = __Pyx_PyObject_FormatSimple(__pyx_v_fmt, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 468, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_26);
        if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 468, __pyx_L16_except_error) }
        __pyx_t_37 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_data), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 468, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_37);
        __pyx_t_38[0] = __pyx_mstate_global->__pyx_kp_u_Error_unpacking;
        __pyx_t_38[1] = __pyx_t_3;
        __pyx_t_38[2] = __pyx_mstate_global->__pyx_kp_u_using_format;
        __pyx_t_38[3] = __pyx_t_26;
        __pyx_t_38[4] = __pyx_mstate_global->__pyx_kp_u_from;
        __pyx_t_38[5] = __pyx_t_37;
        __pyx_t_39 = __Pyx_PyUnicode_Join(__pyx_t_38, 6, 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 14 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_26) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_37), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_26) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_37));
        if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 468, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_39);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
        __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
        __pyx_t_8 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_1);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_8 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_t_39};
          __pyx_t_37 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 468, __pyx_L16_except_error)
          __Pyx_GOTREF(__pyx_t_37);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exc_info, Py_True, __pyx_t_37, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 468, __pyx_L16_except_error)
          __pyx_t_16 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_37);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0;
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 468, __pyx_L16_except_error)
          __Pyx_GOTREF(__pyx_t_16);
        }
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L15_exception_handled;
      }
      goto __pyx_L16_except_error;

      /* "xpra/x11/bindings/randr.pyx":442
 *             raise ValueError(f"invalid format {actual_format}")
 *         log(f"{prop_name!r} : {at} / {actual_format}")
 *         try:             # <<<<<<<<<<<<<<
 *             bytes_per_item = struct.calcsize(b"@%s" % fmt)
 *             nbytes = bytes_per_item * nitems
*/
      __pyx_L16_except_error:;
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      goto __pyx_L1_error;
      __pyx_L20_try_continue:;
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      goto __pyx_L3_continue;
      __pyx_L15_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      __pyx_L21_try_end:;
    }
    __pyx_L3_continue:;
  }

  /* "xpra/x11/bindings/randr.pyx":474
 *                 continue
 *             properties[prop_name] = value
 *     XFree(atoms)             # <<<<<<<<<<<<<<
 *     return properties
 * 
*/
  (void)(XFree(__pyx_v_atoms));

  /* "xpra/x11/bindings/randr.pyx":475
 *             properties[prop_name] = value
 *     XFree(atoms)
 *     return properties             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_properties);
  __pyx_r = __pyx_v_properties;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":396
 * 
 * 
 * cdef dict get_output_properties(Display *display, RROutput output):             # <<<<<<<<<<<<<<
 *     cdef int nprop
 *     cdef Atom *atoms = XRRListOutputProperties(display, output, &nprop)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_26);
  __Pyx_XDECREF(__pyx_t_37);
  __Pyx_XDECREF(__pyx_t_39);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_output_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_properties);
  __Pyx_XDECREF(__pyx_v_prop_name);
  __Pyx_XDECREF(__pyx_v_at);
  __Pyx_XDECREF(__pyx_v_fmt);
  __Pyx_XDECREF(__pyx_v_bytes_per_item);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_parse_edid);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_21get_output_properties_2generator2);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":478
 * 
 * 
 * cdef dict get_all_screen_properties(Display *display):             # <<<<<<<<<<<<<<
 *     cdef Window window = XDefaultRootWindow(display)
 *     cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(display, window)
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_all_screen_properties(Display *__pyx_v_display) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenResources *__pyx_v_rsc;
  RROutput __pyx_v_primary;
  PyObject *__pyx_v_props = NULL;
  int __pyx_v_i;
  int __pyx_v_o;
  PyObject *__pyx_v_output_info = NULL;
  PyObject *__pyx_v_oid = NULL;
  int __pyx_v_crtc;
  PyObject *__pyx_v_crtc_info = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_all_screen_properties", 0);

  /* "xpra/x11/bindings/randr.pyx":479
 * 
 * cdef dict get_all_screen_properties(Display *display):
 *     cdef Window window = XDefaultRootWindow(display)             # <<<<<<<<<<<<<<
 *     cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(display, window)
 *     cdef RROutput primary = XRRGetOutputPrimary(display, window)
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_display);

  /* "xpra/x11/bindings/randr.pyx":480
 * cdef dict get_all_screen_properties(Display *display):
 *     cdef Window window = XDefaultRootWindow(display)
 *     cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(display, window)             # <<<<<<<<<<<<<<
 *     cdef RROutput primary = XRRGetOutputPrimary(display, window)
 *     if rsc==NULL:
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":481
 *     cdef Window window = XDefaultRootWindow(display)
 *     cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(display, window)
 *     cdef RROutput primary = XRRGetOutputPrimary(display, window)             # <<<<<<<<<<<<<<
 *     if rsc==NULL:
 *         log.error("Error: cannot access screen resources")
*/
  __pyx_v_primary = XRRGetOutputPrimary(__pyx_v_display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":482
 *     cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(display, window)
 *     cdef RROutput primary = XRRGetOutputPrimary(display, window)
 *     if rsc==NULL:             # <<<<<<<<<<<<<<
 *         log.error("Error: cannot access screen resources")
 *         return {}
*/
  __pyx_t_1 = (__pyx_v_rsc == NULL);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":483
 *     cdef RROutput primary = XRRGetOutputPrimary(display, window)
 *     if rsc==NULL:
 *         log.error("Error: cannot access screen resources")             # <<<<<<<<<<<<<<
 *         return {}
 *     props = {}
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Error_cannot_access_screen_resou};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":484
 *     if rsc==NULL:
 *         log.error("Error: cannot access screen resources")
 *         return {}             # <<<<<<<<<<<<<<
 *     props = {}
 *     if TIMESTAMPS:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":482
 *     cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(display, window)
 *     cdef RROutput primary = XRRGetOutputPrimary(display, window)
 *     if rsc==NULL:             # <<<<<<<<<<<<<<
 *         log.error("Error: cannot access screen resources")
 *         return {}
*/
  }

  /* "xpra/x11/bindings/randr.pyx":485
 *         log.error("Error: cannot access screen resources")
 *         return {}
 *     props = {}             # <<<<<<<<<<<<<<
 *     if TIMESTAMPS:
 *         props["timestamp"] = rsc.timestamp
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_props = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":486
 *         return {}
 *     props = {}
 *     if TIMESTAMPS:             # <<<<<<<<<<<<<<
 *         props["timestamp"] = rsc.timestamp
 *         props["config-timestamp"] = rsc.configTimestamp
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TIMESTAMPS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 486, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":487
 *     props = {}
 *     if TIMESTAMPS:
 *         props["timestamp"] = rsc.timestamp             # <<<<<<<<<<<<<<
 *         props["config-timestamp"] = rsc.configTimestamp
 *     for i in range(rsc.nmode):
*/
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_rsc->timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely((PyDict_SetItem(__pyx_v_props, __pyx_mstate_global->__pyx_n_u_timestamp, __pyx_t_2) < 0))) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":488
 *     if TIMESTAMPS:
 *         props["timestamp"] = rsc.timestamp
 *         props["config-timestamp"] = rsc.configTimestamp             # <<<<<<<<<<<<<<
 *     for i in range(rsc.nmode):
 *         props.setdefault("modes", {})[i] = get_mode_info(&rsc.modes[i], False)
*/
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_rsc->configTimestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely((PyDict_SetItem(__pyx_v_props, __pyx_mstate_global->__pyx_kp_u_config_timestamp, __pyx_t_2) < 0))) __PYX_ERR(0, 488, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":486
 *         return {}
 *     props = {}
 *     if TIMESTAMPS:             # <<<<<<<<<<<<<<
 *         props["timestamp"] = rsc.timestamp
 *         props["config-timestamp"] = rsc.configTimestamp
*/
  }

  /* "xpra/x11/bindings/randr.pyx":489
 *         props["timestamp"] = rsc.timestamp
 *         props["config-timestamp"] = rsc.configTimestamp
 *     for i in range(rsc.nmode):             # <<<<<<<<<<<<<<
 *         props.setdefault("modes", {})[i] = get_mode_info(&rsc.modes[i], False)
 *     try:
*/
  __pyx_t_7 = __pyx_v_rsc->nmode;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "xpra/x11/bindings/randr.pyx":490
 *         props["config-timestamp"] = rsc.configTimestamp
 *     for i in range(rsc.nmode):
 *         props.setdefault("modes", {})[i] = get_mode_info(&rsc.modes[i], False)             # <<<<<<<<<<<<<<
 *     try:
 *         for o in range(rsc.noutput):
*/
    __pyx_t_2 = __pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info((&(__pyx_v_rsc->modes[__pyx_v_i])), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyDict_SetDefault(__pyx_v_props, __pyx_mstate_global->__pyx_n_u_modes, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely((__Pyx_SetItemInt(__pyx_t_3, __pyx_v_i, __pyx_t_2, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 490, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "xpra/x11/bindings/randr.pyx":491
 *     for i in range(rsc.nmode):
 *         props.setdefault("modes", {})[i] = get_mode_info(&rsc.modes[i], False)
 *     try:             # <<<<<<<<<<<<<<
 *         for o in range(rsc.noutput):
 *             if primary and primary==rsc.outputs[o]:
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":492
 *         props.setdefault("modes", {})[i] = get_mode_info(&rsc.modes[i], False)
 *     try:
 *         for o in range(rsc.noutput):             # <<<<<<<<<<<<<<
 *             if primary and primary==rsc.outputs[o]:
 *                 props["primary-output"] = o
*/
    __pyx_t_7 = __pyx_v_rsc->noutput;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_o = __pyx_t_9;

      /* "xpra/x11/bindings/randr.pyx":493
 *     try:
 *         for o in range(rsc.noutput):
 *             if primary and primary==rsc.outputs[o]:             # <<<<<<<<<<<<<<
 *                 props["primary-output"] = o
 *             output_info = get_output_info(display, rsc, rsc.outputs[o])
*/
      __pyx_t_10 = (__pyx_v_primary != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_10 = (__pyx_v_primary == (__pyx_v_rsc->outputs[__pyx_v_o]));
      __pyx_t_1 = __pyx_t_10;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_1) {

        /* "xpra/x11/bindings/randr.pyx":494
 *         for o in range(rsc.noutput):
 *             if primary and primary==rsc.outputs[o]:
 *                 props["primary-output"] = o             # <<<<<<<<<<<<<<
 *             output_info = get_output_info(display, rsc, rsc.outputs[o])
 *             if output_info:
*/
        __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_o); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely((PyDict_SetItem(__pyx_v_props, __pyx_mstate_global->__pyx_kp_u_primary_output, __pyx_t_2) < 0))) __PYX_ERR(0, 494, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":493
 *     try:
 *         for o in range(rsc.noutput):
 *             if primary and primary==rsc.outputs[o]:             # <<<<<<<<<<<<<<
 *                 props["primary-output"] = o
 *             output_info = get_output_info(display, rsc, rsc.outputs[o])
*/
      }

      /* "xpra/x11/bindings/randr.pyx":495
 *             if primary and primary==rsc.outputs[o]:
 *                 props["primary-output"] = o
 *             output_info = get_output_info(display, rsc, rsc.outputs[o])             # <<<<<<<<<<<<<<
 *             if output_info:
 *                 oid = output_info["id"]
*/
      __pyx_t_2 = __pyx_f_4xpra_3x11_8bindings_5randr_get_output_info(__pyx_v_display, __pyx_v_rsc, (__pyx_v_rsc->outputs[__pyx_v_o])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_output_info, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "xpra/x11/bindings/randr.pyx":496
 *                 props["primary-output"] = o
 *             output_info = get_output_info(display, rsc, rsc.outputs[o])
 *             if output_info:             # <<<<<<<<<<<<<<
 *                 oid = output_info["id"]
 *                 props.setdefault("outputs", {})[oid] = output_info
*/
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_output_info); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 496, __pyx_L8_error)
      if (__pyx_t_1) {

        /* "xpra/x11/bindings/randr.pyx":497
 *             output_info = get_output_info(display, rsc, rsc.outputs[o])
 *             if output_info:
 *                 oid = output_info["id"]             # <<<<<<<<<<<<<<
 *                 props.setdefault("outputs", {})[oid] = output_info
 *         for crtc in range(rsc.ncrtc):
*/
        if (unlikely(__pyx_v_output_info == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 497, __pyx_L8_error)
        }
        __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_output_info, __pyx_mstate_global->__pyx_n_u_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_oid, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":498
 *             if output_info:
 *                 oid = output_info["id"]
 *                 props.setdefault("outputs", {})[oid] = output_info             # <<<<<<<<<<<<<<
 *         for crtc in range(rsc.ncrtc):
 *             crtc_info = get_crtc_info(display, rsc, rsc.crtcs[crtc])
*/
        __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyDict_SetDefault(__pyx_v_props, __pyx_mstate_global->__pyx_n_u_outputs, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_v_oid, __pyx_v_output_info) < 0))) __PYX_ERR(0, 498, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "xpra/x11/bindings/randr.pyx":496
 *                 props["primary-output"] = o
 *             output_info = get_output_info(display, rsc, rsc.outputs[o])
 *             if output_info:             # <<<<<<<<<<<<<<
 *                 oid = output_info["id"]
 *                 props.setdefault("outputs", {})[oid] = output_info
*/
      }
    }

    /* "xpra/x11/bindings/randr.pyx":499
 *                 oid = output_info["id"]
 *                 props.setdefault("outputs", {})[oid] = output_info
 *         for crtc in range(rsc.ncrtc):             # <<<<<<<<<<<<<<
 *             crtc_info = get_crtc_info(display, rsc, rsc.crtcs[crtc])
 *             if crtc_info:
*/
    __pyx_t_7 = __pyx_v_rsc->ncrtc;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_crtc = __pyx_t_9;

      /* "xpra/x11/bindings/randr.pyx":500
 *                 props.setdefault("outputs", {})[oid] = output_info
 *         for crtc in range(rsc.ncrtc):
 *             crtc_info = get_crtc_info(display, rsc, rsc.crtcs[crtc])             # <<<<<<<<<<<<<<
 *             if crtc_info:
 *                 props.setdefault("crtcs", {})[crtc] = crtc_info
*/
      __pyx_t_3 = __pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info(__pyx_v_display, __pyx_v_rsc, (__pyx_v_rsc->crtcs[__pyx_v_crtc])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_crtc_info, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "xpra/x11/bindings/randr.pyx":501
 *         for crtc in range(rsc.ncrtc):
 *             crtc_info = get_crtc_info(display, rsc, rsc.crtcs[crtc])
 *             if crtc_info:             # <<<<<<<<<<<<<<
 *                 props.setdefault("crtcs", {})[crtc] = crtc_info
 *     finally:
*/
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_crtc_info); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 501, __pyx_L8_error)
      if (__pyx_t_1) {

        /* "xpra/x11/bindings/randr.pyx":502
 *             crtc_info = get_crtc_info(display, rsc, rsc.crtcs[crtc])
 *             if crtc_info:
 *                 props.setdefault("crtcs", {})[crtc] = crtc_info             # <<<<<<<<<<<<<<
 *     finally:
 *         XRRFreeScreenResources(rsc)
*/
        __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyDict_SetDefault(__pyx_v_props, __pyx_mstate_global->__pyx_n_u_crtcs, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely((__Pyx_SetItemInt(__pyx_t_2, __pyx_v_crtc, __pyx_v_crtc_info, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 502, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":501
 *         for crtc in range(rsc.ncrtc):
 *             crtc_info = get_crtc_info(display, rsc, rsc.crtcs[crtc])
 *             if crtc_info:             # <<<<<<<<<<<<<<
 *                 props.setdefault("crtcs", {})[crtc] = crtc_info
 *     finally:
*/
      }
    }
  }

  /* "xpra/x11/bindings/randr.pyx":504
 *                 props.setdefault("crtcs", {})[crtc] = crtc_info
 *     finally:
 *         XRRFreeScreenResources(rsc)             # <<<<<<<<<<<<<<
 *     props["monitors"] = monitor_properties(display)
 *     return props
*/
  /*finally:*/ {
    /*normal exit:*/{
      XRRFreeScreenResources(__pyx_v_rsc);
      goto __pyx_L9;
    }
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        XRRFreeScreenResources(__pyx_v_rsc);
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L9:;
  }

  /* "xpra/x11/bindings/randr.pyx":505
 *     finally:
 *         XRRFreeScreenResources(rsc)
 *     props["monitors"] = monitor_properties(display)             # <<<<<<<<<<<<<<
 *     return props
 * 
*/
  __pyx_t_2 = __pyx_f_4xpra_3x11_8bindings_5randr_monitor_properties(__pyx_v_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely((PyDict_SetItem(__pyx_v_props, __pyx_mstate_global->__pyx_n_u_monitors, __pyx_t_2) < 0))) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":506
 *         XRRFreeScreenResources(rsc)
 *     props["monitors"] = monitor_properties(display)
 *     return props             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_props);
  __pyx_r = __pyx_v_props;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":478
 * 
 * 
 * cdef dict get_all_screen_properties(Display *display):             # <<<<<<<<<<<<<<
 *     cdef Window window = XDefaultRootWindow(display)
 *     cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(display, window)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_all_screen_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_props);
  __Pyx_XDECREF(__pyx_v_output_info);
  __Pyx_XDECREF(__pyx_v_oid);
  __Pyx_XDECREF(__pyx_v_crtc_info);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":518
 *     }
 *     if ci.noutput:
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))             # <<<<<<<<<<<<<<
 *     if TIMESTAMPS:
 *         info["timestamp"] = int(ci.timestamp)
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 518, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_2generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_crtc_info_locals_genexpr, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_crtc_info.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 518, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_5 = NULL;
    __pyx_t_6 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_ci->outputs[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 518, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 518, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_5generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":534
 *             if gamma and gamma.size:
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_3genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 534, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_5generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_crtc_info_locals_genexpr, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 534, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_crtc_info.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_5generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 534, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_short((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_gamma->red[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 534, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_8generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":535
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),
 *                 }
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_6genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 535, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_8generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_crtc_info_locals_genexpr, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_crtc_info.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_8generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 535, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_short((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_gamma->green[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 535, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_11generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":536
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                 }
 *                 XRRFreeGamma(gamma)
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_9genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 536, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_11generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_crtc_info_locals_genexpr, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_crtc_info.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_11generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 536, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_short((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_gamma->blue[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 536, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":509
 * 
 * 
 * cdef dict get_crtc_info(Display *display, XRRScreenResources *rsc, RRCrtc crtc):             # <<<<<<<<<<<<<<
 *     cdef XRRCrtcInfo *ci = XRRGetCrtcInfo(display, rsc, crtc)
 *     if ci==NULL:
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info(Display *__pyx_v_display, XRRScreenResources *__pyx_v_rsc, RRCrtc __pyx_v_crtc) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *__pyx_cur_scope;
  PyObject *__pyx_v_info = NULL;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_2generator3 = 0;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_5generator4 = 0;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_8generator5 = 0;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_11generator6 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_crtc_info", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 509, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }

  /* "xpra/x11/bindings/randr.pyx":510
 * 
 * cdef dict get_crtc_info(Display *display, XRRScreenResources *rsc, RRCrtc crtc):
 *     cdef XRRCrtcInfo *ci = XRRGetCrtcInfo(display, rsc, crtc)             # <<<<<<<<<<<<<<
 *     if ci==NULL:
 *         return {}
*/
  __pyx_cur_scope->__pyx_v_ci = XRRGetCrtcInfo(__pyx_v_display, __pyx_v_rsc, __pyx_v_crtc);

  /* "xpra/x11/bindings/randr.pyx":511
 * cdef dict get_crtc_info(Display *display, XRRScreenResources *rsc, RRCrtc crtc):
 *     cdef XRRCrtcInfo *ci = XRRGetCrtcInfo(display, rsc, crtc)
 *     if ci==NULL:             # <<<<<<<<<<<<<<
 *         return {}
 *     info = {
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_ci == NULL);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":512
 *     cdef XRRCrtcInfo *ci = XRRGetCrtcInfo(display, rsc, crtc)
 *     if ci==NULL:
 *         return {}             # <<<<<<<<<<<<<<
 *     info = {
 *         "noutput"   : ci.noutput,
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":511
 * cdef dict get_crtc_info(Display *display, XRRScreenResources *rsc, RRCrtc crtc):
 *     cdef XRRCrtcInfo *ci = XRRGetCrtcInfo(display, rsc, crtc)
 *     if ci==NULL:             # <<<<<<<<<<<<<<
 *         return {}
 *     info = {
*/
  }

  /* "xpra/x11/bindings/randr.pyx":514
 *         return {}
 *     info = {
 *         "noutput"   : ci.noutput,             # <<<<<<<<<<<<<<
 *         "npossible" : ci.npossible,
 *     }
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_ci->noutput); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_noutput, __pyx_t_3) < (0)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "xpra/x11/bindings/randr.pyx":515
 *     info = {
 *         "noutput"   : ci.noutput,
 *         "npossible" : ci.npossible,             # <<<<<<<<<<<<<<
 *     }
 *     if ci.noutput:
*/
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_ci->npossible); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_npossible, __pyx_t_3) < (0)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_info = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":517
 *         "npossible" : ci.npossible,
 *     }
 *     if ci.noutput:             # <<<<<<<<<<<<<<
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))
 *     if TIMESTAMPS:
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_ci->noutput != 0);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":518
 *     }
 *     if ci.noutput:
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))             # <<<<<<<<<<<<<<
 *     if TIMESTAMPS:
 *         info["timestamp"] = int(ci.timestamp)
*/
    __pyx_t_2 = __pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_ci->noutput); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_outputs, __pyx_t_3) < 0))) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":517
 *         "npossible" : ci.npossible,
 *     }
 *     if ci.noutput:             # <<<<<<<<<<<<<<
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))
 *     if TIMESTAMPS:
*/
  }

  /* "xpra/x11/bindings/randr.pyx":519
 *     if ci.noutput:
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))
 *     if TIMESTAMPS:             # <<<<<<<<<<<<<<
 *         info["timestamp"] = int(ci.timestamp)
 *     cdef XRRCrtcGamma *gamma
*/
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_TIMESTAMPS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":520
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))
 *     if TIMESTAMPS:
 *         info["timestamp"] = int(ci.timestamp)             # <<<<<<<<<<<<<<
 *     cdef XRRCrtcGamma *gamma
 *     if ci.mode or ci.width or ci.height or ci.noutput:
*/
    __pyx_t_2 = NULL;
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_ci->timestamp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_timestamp, __pyx_t_3) < 0))) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":519
 *     if ci.noutput:
 *         info["outputs"] = tuple(int(ci.outputs[i]) for i in range(ci.noutput))
 *     if TIMESTAMPS:             # <<<<<<<<<<<<<<
 *         info["timestamp"] = int(ci.timestamp)
 *     cdef XRRCrtcGamma *gamma
*/
  }

  /* "xpra/x11/bindings/randr.pyx":522
 *         info["timestamp"] = int(ci.timestamp)
 *     cdef XRRCrtcGamma *gamma
 *     if ci.mode or ci.width or ci.height or ci.noutput:             # <<<<<<<<<<<<<<
 *         info |= {
 *             "x"         : ci.x,
*/
  __pyx_t_6 = (__pyx_cur_scope->__pyx_v_ci->mode != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_cur_scope->__pyx_v_ci->width != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_cur_scope->__pyx_v_ci->height != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_cur_scope->__pyx_v_ci->noutput != 0);
  __pyx_t_1 = __pyx_t_6;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":524
 *     if ci.mode or ci.width or ci.height or ci.noutput:
 *         info |= {
 *             "x"         : ci.x,             # <<<<<<<<<<<<<<
 *             "y"         : ci.y,
 *             "width"     : ci.width,
*/
    __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_ci->x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_x, __pyx_t_4) < (0)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":525
 *         info |= {
 *             "x"         : ci.x,
 *             "y"         : ci.y,             # <<<<<<<<<<<<<<
 *             "width"     : ci.width,
 *             "height"    : ci.height,
*/
    __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_ci->y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_y, __pyx_t_4) < (0)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":526
 *             "x"         : ci.x,
 *             "y"         : ci.y,
 *             "width"     : ci.width,             # <<<<<<<<<<<<<<
 *             "height"    : ci.height,
 *             "mode"      : ci.mode,
*/
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_ci->width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_width, __pyx_t_4) < (0)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":527
 *             "y"         : ci.y,
 *             "width"     : ci.width,
 *             "height"    : ci.height,             # <<<<<<<<<<<<<<
 *             "mode"      : ci.mode,
 *         }
*/
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_ci->height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_height, __pyx_t_4) < (0)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":528
 *             "width"     : ci.width,
 *             "height"    : ci.height,
 *             "mode"      : ci.mode,             # <<<<<<<<<<<<<<
 *         }
 *         if GAMMA:
*/
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_ci->mode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_mode, __pyx_t_4) < (0)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":523
 *     cdef XRRCrtcGamma *gamma
 *     if ci.mode or ci.width or ci.height or ci.noutput:
 *         info |= {             # <<<<<<<<<<<<<<
 *             "x"         : ci.x,
 *             "y"         : ci.y,
*/
    __pyx_t_4 = PyNumber_InPlaceOr(__pyx_v_info, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_info, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":530
 *             "mode"      : ci.mode,
 *         }
 *         if GAMMA:             # <<<<<<<<<<<<<<
 *             gamma = XRRGetCrtcGamma(display, crtc)
 *             if gamma and gamma.size:
*/
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_GAMMA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 530, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "xpra/x11/bindings/randr.pyx":531
 *         }
 *         if GAMMA:
 *             gamma = XRRGetCrtcGamma(display, crtc)             # <<<<<<<<<<<<<<
 *             if gamma and gamma.size:
 *                 info["gamma"] = {
*/
      __pyx_cur_scope->__pyx_v_gamma = XRRGetCrtcGamma(__pyx_v_display, __pyx_v_crtc);

      /* "xpra/x11/bindings/randr.pyx":532
 *         if GAMMA:
 *             gamma = XRRGetCrtcGamma(display, crtc)
 *             if gamma and gamma.size:             # <<<<<<<<<<<<<<
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
*/
      __pyx_t_6 = (__pyx_cur_scope->__pyx_v_gamma != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_6 = (__pyx_cur_scope->__pyx_v_gamma->size != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_1) {

        /* "xpra/x11/bindings/randr.pyx":534
 *             if gamma and gamma.size:
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),
*/
        __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_gamma->size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_red, __pyx_t_2) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":535
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),
 *                 }
*/
        __pyx_t_2 = __pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_6genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_gamma->size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_green, __pyx_t_3) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "xpra/x11/bindings/randr.pyx":536
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),             # <<<<<<<<<<<<<<
 *                 }
 *                 XRRFreeGamma(gamma)
*/
        __pyx_t_3 = __pyx_pf_4xpra_3x11_8bindings_5randr_13get_crtc_info_9genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_gamma->size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_blue, __pyx_t_2) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":533
 *             gamma = XRRGetCrtcGamma(display, crtc)
 *             if gamma and gamma.size:
 *                 info["gamma"] = {             # <<<<<<<<<<<<<<
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
 *                     "green" : tuple(gamma.green[i] for i in range(gamma.size)),
*/
        if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_gamma, __pyx_t_4) < 0))) __PYX_ERR(0, 533, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "xpra/x11/bindings/randr.pyx":538
 *                     "blue"  : tuple(gamma.blue[i] for i in range(gamma.size)),
 *                 }
 *                 XRRFreeGamma(gamma)             # <<<<<<<<<<<<<<
 *     if ci.rotation!=RR_Rotate_0:
 *         info["rotation"] = get_rotation(ci.rotation)
*/
        XRRFreeGamma(__pyx_cur_scope->__pyx_v_gamma);

        /* "xpra/x11/bindings/randr.pyx":532
 *         if GAMMA:
 *             gamma = XRRGetCrtcGamma(display, crtc)
 *             if gamma and gamma.size:             # <<<<<<<<<<<<<<
 *                 info["gamma"] = {
 *                     "red"   : tuple(gamma.red[i] for i in range(gamma.size)),
*/
      }

      /* "xpra/x11/bindings/randr.pyx":530
 *             "mode"      : ci.mode,
 *         }
 *         if GAMMA:             # <<<<<<<<<<<<<<
 *             gamma = XRRGetCrtcGamma(display, crtc)
 *             if gamma and gamma.size:
*/
    }

    /* "xpra/x11/bindings/randr.pyx":522
 *         info["timestamp"] = int(ci.timestamp)
 *     cdef XRRCrtcGamma *gamma
 *     if ci.mode or ci.width or ci.height or ci.noutput:             # <<<<<<<<<<<<<<
 *         info |= {
 *             "x"         : ci.x,
*/
  }

  /* "xpra/x11/bindings/randr.pyx":539
 *                 }
 *                 XRRFreeGamma(gamma)
 *     if ci.rotation!=RR_Rotate_0:             # <<<<<<<<<<<<<<
 *         info["rotation"] = get_rotation(ci.rotation)
 *     if ci.rotations!=RR_Rotate_0:
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_ci->rotation != RR_Rotate_0);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":540
 *                 XRRFreeGamma(gamma)
 *     if ci.rotation!=RR_Rotate_0:
 *         info["rotation"] = get_rotation(ci.rotation)             # <<<<<<<<<<<<<<
 *     if ci.rotations!=RR_Rotate_0:
 *         info["rotations"] = get_rotations(ci.rotations)
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_rotation); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyLong_From_Rotation(__pyx_cur_scope->__pyx_v_ci->rotation); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_rotation, __pyx_t_4) < 0))) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":539
 *                 }
 *                 XRRFreeGamma(gamma)
 *     if ci.rotation!=RR_Rotate_0:             # <<<<<<<<<<<<<<
 *         info["rotation"] = get_rotation(ci.rotation)
 *     if ci.rotations!=RR_Rotate_0:
*/
  }

  /* "xpra/x11/bindings/randr.pyx":541
 *     if ci.rotation!=RR_Rotate_0:
 *         info["rotation"] = get_rotation(ci.rotation)
 *     if ci.rotations!=RR_Rotate_0:             # <<<<<<<<<<<<<<
 *         info["rotations"] = get_rotations(ci.rotations)
 *     XRRFreeCrtcInfo(ci)
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_ci->rotations != RR_Rotate_0);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":542
 *         info["rotation"] = get_rotation(ci.rotation)
 *     if ci.rotations!=RR_Rotate_0:
 *         info["rotations"] = get_rotations(ci.rotations)             # <<<<<<<<<<<<<<
 *     XRRFreeCrtcInfo(ci)
 *     return info
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_get_rotations); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyLong_From_Rotation(__pyx_cur_scope->__pyx_v_ci->rotations); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 542, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_rotations, __pyx_t_4) < 0))) __PYX_ERR(0, 542, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":541
 *     if ci.rotation!=RR_Rotate_0:
 *         info["rotation"] = get_rotation(ci.rotation)
 *     if ci.rotations!=RR_Rotate_0:             # <<<<<<<<<<<<<<
 *         info["rotations"] = get_rotations(ci.rotations)
 *     XRRFreeCrtcInfo(ci)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":543
 *     if ci.rotations!=RR_Rotate_0:
 *         info["rotations"] = get_rotations(ci.rotations)
 *     XRRFreeCrtcInfo(ci)             # <<<<<<<<<<<<<<
 *     return info
 * 
*/
  XRRFreeCrtcInfo(__pyx_cur_scope->__pyx_v_ci);

  /* "xpra/x11/bindings/randr.pyx":544
 *         info["rotations"] = get_rotations(ci.rotations)
 *     XRRFreeCrtcInfo(ci)
 *     return info             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_info);
  __pyx_r = __pyx_v_info;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":509
 * 
 * 
 * cdef dict get_crtc_info(Display *display, XRRScreenResources *rsc, RRCrtc crtc):             # <<<<<<<<<<<<<<
 *     cdef XRRCrtcInfo *ci = XRRGetCrtcInfo(display, rsc, crtc)
 *     if ci==NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_crtc_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_2generator3);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_5generator4);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_8generator5);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_13get_crtc_info_11generator6);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":547
 * 
 * 
 * cdef dict monitor_properties(Display *display):             # <<<<<<<<<<<<<<
 *     cdef int nmonitors
 *     cdef Window window = XDefaultRootWindow(display)
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_monitor_properties(Display *__pyx_v_display) {
  int __pyx_v_nmonitors;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRMonitorInfo *__pyx_v_monitors;
  XRRMonitorInfo *__pyx_v_m;
  PyObject *__pyx_v_props = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_mprops = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("monitor_properties", 0);

  /* "xpra/x11/bindings/randr.pyx":549
 * cdef dict monitor_properties(Display *display):
 *     cdef int nmonitors
 *     cdef Window window = XDefaultRootWindow(display)             # <<<<<<<<<<<<<<
 *     cdef XRRMonitorInfo *monitors = XRRGetMonitors(display, window, True, &nmonitors)
 *     cdef XRRMonitorInfo *m
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_display);

  /* "xpra/x11/bindings/randr.pyx":550
 *     cdef int nmonitors
 *     cdef Window window = XDefaultRootWindow(display)
 *     cdef XRRMonitorInfo *monitors = XRRGetMonitors(display, window, True, &nmonitors)             # <<<<<<<<<<<<<<
 *     cdef XRRMonitorInfo *m
 *     props = {}
*/
  __pyx_v_monitors = XRRGetMonitors(__pyx_v_display, __pyx_v_window, 1, (&__pyx_v_nmonitors));

  /* "xpra/x11/bindings/randr.pyx":552
 *     cdef XRRMonitorInfo *monitors = XRRGetMonitors(display, window, True, &nmonitors)
 *     cdef XRRMonitorInfo *m
 *     props = {}             # <<<<<<<<<<<<<<
 *     for i in range(nmonitors):
 *         m = &monitors[i]
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_props = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":553
 *     cdef XRRMonitorInfo *m
 *     props = {}
 *     for i in range(nmonitors):             # <<<<<<<<<<<<<<
 *         m = &monitors[i]
 *         mprops = _monitor_properties(display, m)
*/
  __pyx_t_2 = __pyx_v_nmonitors;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "xpra/x11/bindings/randr.pyx":554
 *     props = {}
 *     for i in range(nmonitors):
 *         m = &monitors[i]             # <<<<<<<<<<<<<<
 *         mprops = _monitor_properties(display, m)
 *         mprops["index"] = i
*/
    __pyx_v_m = (&(__pyx_v_monitors[__pyx_v_i]));

    /* "xpra/x11/bindings/randr.pyx":555
 *     for i in range(nmonitors):
 *         m = &monitors[i]
 *         mprops = _monitor_properties(display, m)             # <<<<<<<<<<<<<<
 *         mprops["index"] = i
 *         props[i] = mprops
*/
    __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties(__pyx_v_display, __pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_mprops, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":556
 *         m = &monitors[i]
 *         mprops = _monitor_properties(display, m)
 *         mprops["index"] = i             # <<<<<<<<<<<<<<
 *         props[i] = mprops
 *     XRRFreeMonitors(monitors)
*/
    __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely((PyObject_SetItem(__pyx_v_mprops, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_1) < 0))) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":557
 *         mprops = _monitor_properties(display, m)
 *         mprops["index"] = i
 *         props[i] = mprops             # <<<<<<<<<<<<<<
 *     XRRFreeMonitors(monitors)
 *     return props
*/
    __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely((PyDict_SetItem(__pyx_v_props, __pyx_t_1, __pyx_v_mprops) < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "xpra/x11/bindings/randr.pyx":558
 *         mprops["index"] = i
 *         props[i] = mprops
 *     XRRFreeMonitors(monitors)             # <<<<<<<<<<<<<<
 *     return props
 * 
*/
  XRRFreeMonitors(__pyx_v_monitors);

  /* "xpra/x11/bindings/randr.pyx":559
 *         props[i] = mprops
 *     XRRFreeMonitors(monitors)
 *     return props             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_props);
  __pyx_r = __pyx_v_props;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":547
 * 
 * 
 * cdef dict monitor_properties(Display *display):             # <<<<<<<<<<<<<<
 *     cdef int nmonitors
 *     cdef Window window = XDefaultRootWindow(display)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.monitor_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_props);
  __Pyx_XDECREF(__pyx_v_mprops);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_19_monitor_properties_2generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":574
 *         "height-mm" : m.mheight,
 *         #"outputs"   : tuple(rroutput_map.get(m.outputs[j], 0) for j in range(m.noutput)),
 *         "outputs"   : tuple(m.outputs[j] for j in range(m.noutput)),             # <<<<<<<<<<<<<<
 *     }
 * 
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_19_monitor_properties_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 574, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_19_monitor_properties_2generator7, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_monitor_properties_locals_genex, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr._monitor_properties.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_19_monitor_properties_2generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 574, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_j = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_m->outputs[__pyx_cur_scope->__pyx_v_j])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 574, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":562
 * 
 * 
 * cdef object _monitor_properties(Display *display, XRRMonitorInfo *m):             # <<<<<<<<<<<<<<
 *     return {
 *         "name"      : get_XAtom(display, m.name),
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties(Display *__pyx_v_display, XRRMonitorInfo *__pyx_v_m) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties *__pyx_cur_scope;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_19_monitor_properties_2generator7 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_monitor_properties", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 562, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_m = __pyx_v_m;

  /* "xpra/x11/bindings/randr.pyx":563
 * 
 * cdef object _monitor_properties(Display *display, XRRMonitorInfo *m):
 *     return {             # <<<<<<<<<<<<<<
 *         "name"      : get_XAtom(display, m.name),
 *         "primary"   : bool(m.primary),
*/
  __Pyx_XDECREF(__pyx_r);

  /* "xpra/x11/bindings/randr.pyx":564
 * cdef object _monitor_properties(Display *display, XRRMonitorInfo *m):
 *     return {
 *         "name"      : get_XAtom(display, m.name),             # <<<<<<<<<<<<<<
 *         "primary"   : bool(m.primary),
 *         "automatic" : bool(m.automatic),
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4xpra_3x11_8bindings_5randr_get_XAtom(__pyx_v_display, __pyx_cur_scope->__pyx_v_m->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_name, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":565
 *     return {
 *         "name"      : get_XAtom(display, m.name),
 *         "primary"   : bool(m.primary),             # <<<<<<<<<<<<<<
 *         "automatic" : bool(m.automatic),
 *         "x"         : m.x,
*/
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(!(__pyx_cur_scope->__pyx_v_m->primary != 0)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_primary, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":566
 *         "name"      : get_XAtom(display, m.name),
 *         "primary"   : bool(m.primary),
 *         "automatic" : bool(m.automatic),             # <<<<<<<<<<<<<<
 *         "x"         : m.x,
 *         "y"         : m.y,
*/
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(!(__pyx_cur_scope->__pyx_v_m->automatic != 0)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_automatic, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":567
 *         "primary"   : bool(m.primary),
 *         "automatic" : bool(m.automatic),
 *         "x"         : m.x,             # <<<<<<<<<<<<<<
 *         "y"         : m.y,
 *         "width"     : m.width,
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_m->x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":568
 *         "automatic" : bool(m.automatic),
 *         "x"         : m.x,
 *         "y"         : m.y,             # <<<<<<<<<<<<<<
 *         "width"     : m.width,
 *         "height"    : m.height,
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_m->y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_y, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":569
 *         "x"         : m.x,
 *         "y"         : m.y,
 *         "width"     : m.width,             # <<<<<<<<<<<<<<
 *         "height"    : m.height,
 *         "width-mm"  : m.mwidth,
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_m->width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_width, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":570
 *         "y"         : m.y,
 *         "width"     : m.width,
 *         "height"    : m.height,             # <<<<<<<<<<<<<<
 *         "width-mm"  : m.mwidth,
 *         "height-mm" : m.mheight,
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_m->height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_height, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":571
 *         "width"     : m.width,
 *         "height"    : m.height,
 *         "width-mm"  : m.mwidth,             # <<<<<<<<<<<<<<
 *         "height-mm" : m.mheight,
 *         #"outputs"   : tuple(rroutput_map.get(m.outputs[j], 0) for j in range(m.noutput)),
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_m->mwidth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_width_mm, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":572
 *         "height"    : m.height,
 *         "width-mm"  : m.mwidth,
 *         "height-mm" : m.mheight,             # <<<<<<<<<<<<<<
 *         #"outputs"   : tuple(rroutput_map.get(m.outputs[j], 0) for j in range(m.noutput)),
 *         "outputs"   : tuple(m.outputs[j] for j in range(m.noutput)),
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_m->mheight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_height_mm, __pyx_t_2) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":574
 *         "height-mm" : m.mheight,
 *         #"outputs"   : tuple(rroutput_map.get(m.outputs[j], 0) for j in range(m.noutput)),
 *         "outputs"   : tuple(m.outputs[j] for j in range(m.noutput)),             # <<<<<<<<<<<<<<
 *     }
 * 
*/
  __pyx_t_2 = __pyx_pf_4xpra_3x11_8bindings_5randr_19_monitor_properties_genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_m->noutput); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_outputs, __pyx_t_3) < (0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":562
 * 
 * 
 * cdef object _monitor_properties(Display *display, XRRMonitorInfo *m):             # <<<<<<<<<<<<<<
 *     return {
 *         "name"      : get_XAtom(display, m.name),
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("xpra.x11.bindings.randr._monitor_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_19_monitor_properties_2generator7);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":578
 * 
 * 
 * def get_monitor_properties(display: int) -> dict:             # <<<<<<<<<<<<<<
 *     log("get_monitor_properties(%#x)", display)
 *     cdef Display *d = <Display *> (<uintptr_t> display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_5get_monitor_properties(PyObject *__pyx_self, PyObject *__pyx_v_display); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_5get_monitor_properties = {"get_monitor_properties", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_5get_monitor_properties, METH_O, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_5get_monitor_properties(PyObject *__pyx_self, PyObject *__pyx_v_display) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_monitor_properties (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_display), (&PyLong_Type), 0, "display", 2))) __PYX_ERR(0, 578, __pyx_L1_error)
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_4get_monitor_properties(__pyx_self, ((PyObject*)__pyx_v_display));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_4get_monitor_properties(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_display) {
  Display *__pyx_v_d;
  PyObject *__pyx_v_version = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  uintptr_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_monitor_properties", 0);

  /* "xpra/x11/bindings/randr.pyx":579
 * 
 * def get_monitor_properties(display: int) -> dict:
 *     log("get_monitor_properties(%#x)", display)             # <<<<<<<<<<<<<<
 *     cdef Display *d = <Display *> (<uintptr_t> display)
 *     version = query_version(d)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_get_monitor_properties_x, __pyx_v_display};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":580
 * def get_monitor_properties(display: int) -> dict:
 *     log("get_monitor_properties(%#x)", display)
 *     cdef Display *d = <Display *> (<uintptr_t> display)             # <<<<<<<<<<<<<<
 *     version = query_version(d)
 *     log("version=%s", version)
*/
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_v_display); if (unlikely((__pyx_t_5 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L1_error)
  __pyx_v_d = ((Display *)((uintptr_t)__pyx_t_5));

  /* "xpra/x11/bindings/randr.pyx":581
 *     log("get_monitor_properties(%#x)", display)
 *     cdef Display *d = <Display *> (<uintptr_t> display)
 *     version = query_version(d)             # <<<<<<<<<<<<<<
 *     log("version=%s", version)
 *     if version < (1, 2):
*/
  __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_query_version(__pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_version = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":582
 *     cdef Display *d = <Display *> (<uintptr_t> display)
 *     version = query_version(d)
 *     log("version=%s", version)             # <<<<<<<<<<<<<<
 *     if version < (1, 2):
 *         log.warn("Warning: XRandR version %s does not support monitors", version)
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_version_s, __pyx_v_version};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":583
 *     version = query_version(d)
 *     log("version=%s", version)
 *     if version < (1, 2):             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR version %s does not support monitors", version)
 *         return {}
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_mstate_global->__pyx_tuple[0], Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "xpra/x11/bindings/randr.pyx":584
 *     log("version=%s", version)
 *     if version < (1, 2):
 *         log.warn("Warning: XRandR version %s does not support monitors", version)             # <<<<<<<<<<<<<<
 *         return {}
 *     return monitor_properties(d)
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Warning_XRandR_version_s_does_no, __pyx_v_version};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":585
 *     if version < (1, 2):
 *         log.warn("Warning: XRandR version %s does not support monitors", version)
 *         return {}             # <<<<<<<<<<<<<<
 *     return monitor_properties(d)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":583
 *     version = query_version(d)
 *     log("version=%s", version)
 *     if version < (1, 2):             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR version %s does not support monitors", version)
 *         return {}
*/
  }

  /* "xpra/x11/bindings/randr.pyx":586
 *         log.warn("Warning: XRandR version %s does not support monitors", version)
 *         return {}
 *     return monitor_properties(d)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_monitor_properties(__pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":578
 * 
 * 
 * def get_monitor_properties(display: int) -> dict:             # <<<<<<<<<<<<<<
 *     log("get_monitor_properties(%#x)", display)
 *     cdef Display *d = <Display *> (<uintptr_t> display)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.get_monitor_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":589
 * 
 * 
 * cdef Tuple query_version(Display *display):             # <<<<<<<<<<<<<<
 *     cdef int event_base = 0, ignored = 0
 *     cdef int r = XRRQueryExtension(display, &event_base, &ignored)
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_query_version(Display *__pyx_v_display) {
  int __pyx_v_event_base;
  int __pyx_v_ignored;
  int __pyx_v_r;
  int __pyx_v_major;
  int __pyx_v_minor;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[6];
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("query_version", 0);

  /* "xpra/x11/bindings/randr.pyx":590
 * 
 * cdef Tuple query_version(Display *display):
 *     cdef int event_base = 0, ignored = 0             # <<<<<<<<<<<<<<
 *     cdef int r = XRRQueryExtension(display, &event_base, &ignored)
 *     if not r:
*/
  __pyx_v_event_base = 0;
  __pyx_v_ignored = 0;

  /* "xpra/x11/bindings/randr.pyx":591
 * cdef Tuple query_version(Display *display):
 *     cdef int event_base = 0, ignored = 0
 *     cdef int r = XRRQueryExtension(display, &event_base, &ignored)             # <<<<<<<<<<<<<<
 *     if not r:
 *         log(f"no XRandR!")
*/
  __pyx_v_r = XRRQueryExtension(__pyx_v_display, (&__pyx_v_event_base), (&__pyx_v_ignored));

  /* "xpra/x11/bindings/randr.pyx":592
 *     cdef int event_base = 0, ignored = 0
 *     cdef int r = XRRQueryExtension(display, &event_base, &ignored)
 *     if not r:             # <<<<<<<<<<<<<<
 *         log(f"no XRandR!")
 *         return (0, 0)
*/
  __pyx_t_1 = (!(__pyx_v_r != 0));
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":593
 *     cdef int r = XRRQueryExtension(display, &event_base, &ignored)
 *     if not r:
 *         log(f"no XRandR!")             # <<<<<<<<<<<<<<
 *         return (0, 0)
 *     cdef int major = 0, minor = 0
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_no_XRandR};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":594
 *     if not r:
 *         log(f"no XRandR!")
 *         return (0, 0)             # <<<<<<<<<<<<<<
 *     cdef int major = 0, minor = 0
 *     if not XRRQueryVersion(display, &major, &minor):
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
    __pyx_r = __pyx_mstate_global->__pyx_tuple[1];
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":592
 *     cdef int event_base = 0, ignored = 0
 *     cdef int r = XRRQueryExtension(display, &event_base, &ignored)
 *     if not r:             # <<<<<<<<<<<<<<
 *         log(f"no XRandR!")
 *         return (0, 0)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":595
 *         log(f"no XRandR!")
 *         return (0, 0)
 *     cdef int major = 0, minor = 0             # <<<<<<<<<<<<<<
 *     if not XRRQueryVersion(display, &major, &minor):
 *         log.warn("Warning: XRandR version check failed")
*/
  __pyx_v_major = 0;
  __pyx_v_minor = 0;

  /* "xpra/x11/bindings/randr.pyx":596
 *         return (0, 0)
 *     cdef int major = 0, minor = 0
 *     if not XRRQueryVersion(display, &major, &minor):             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR version check failed")
 *         return (0, 0)
*/
  __pyx_t_1 = (!(XRRQueryVersion(__pyx_v_display, (&__pyx_v_major), (&__pyx_v_minor)) != 0));
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":597
 *     cdef int major = 0, minor = 0
 *     if not XRRQueryVersion(display, &major, &minor):
 *         log.warn("Warning: XRandR version check failed")             # <<<<<<<<<<<<<<
 *         return (0, 0)
 *     log(f"found XRandR extension version {major}.{minor} with event_base={event_base}")
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Warning_XRandR_version_check_fai};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":598
 *     if not XRRQueryVersion(display, &major, &minor):
 *         log.warn("Warning: XRandR version check failed")
 *         return (0, 0)             # <<<<<<<<<<<<<<
 *     log(f"found XRandR extension version {major}.{minor} with event_base={event_base}")
 *     return major, minor
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
    __pyx_r = __pyx_mstate_global->__pyx_tuple[1];
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":596
 *         return (0, 0)
 *     cdef int major = 0, minor = 0
 *     if not XRRQueryVersion(display, &major, &minor):             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR version check failed")
 *         return (0, 0)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":599
 *         log.warn("Warning: XRandR version check failed")
 *         return (0, 0)
 *     log(f"found XRandR extension version {major}.{minor} with event_base={event_base}")             # <<<<<<<<<<<<<<
 *     return major, minor
 * 
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_major, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_minor, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_event_base, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_found_XRandR_extension_version;
  __pyx_t_9[1] = __pyx_t_3;
  __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u__4;
  __pyx_t_9[3] = __pyx_t_7;
  __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u_with_event_base;
  __pyx_t_9[5] = __pyx_t_8;
  __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_9, 6, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127);
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":600
 *         return (0, 0)
 *     log(f"found XRandR extension version {major}.{minor} with event_base={event_base}")
 *     return major, minor             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_major); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_minor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 600, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 600, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":589
 * 
 * 
 * cdef Tuple query_version(Display *display):             # <<<<<<<<<<<<<<
 *     cdef int event_base = 0, ignored = 0
 *     cdef int r = XRRQueryExtension(display, &event_base, &ignored)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.query_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":610
 *     cdef object version
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._added_modes = {}
 *         self.version = query_version(self.display)
*/

/* Python wrapper */
static int __pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance___init__(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance___init__(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "xpra/x11/bindings/randr.pyx":611
 * 
 *     def __init__(self):
 *         self._added_modes = {}             # <<<<<<<<<<<<<<
 *         self.version = query_version(self.display)
 *         self._has_randr = self.version > (1, 0) and self.check_randr_sizes()
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_added_modes);
  __Pyx_DECREF(__pyx_v_self->_added_modes);
  __pyx_v_self->_added_modes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":612
 *     def __init__(self):
 *         self._added_modes = {}
 *         self.version = query_version(self.display)             # <<<<<<<<<<<<<<
 *         self._has_randr = self.version > (1, 0) and self.check_randr_sizes()
 * 
*/
  __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_query_version(__pyx_v_self->__pyx_base.display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->version);
  __Pyx_DECREF(__pyx_v_self->version);
  __pyx_v_self->version = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":613
 *         self._added_modes = {}
 *         self.version = query_version(self.display)
 *         self._has_randr = self.version > (1, 0) and self.check_randr_sizes()             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->version, __pyx_mstate_global->__pyx_tuple[2], Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 613, __pyx_L1_error)
  if (__pyx_t_3) {
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 613, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_5 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_check_randr_sizes, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 613, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_v_self->_has_randr = __pyx_t_2;

  /* "xpra/x11/bindings/randr.pyx":610
 *     cdef object version
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._added_modes = {}
 *         self.version = query_version(self.display)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":615
 *         self._has_randr = self.version > (1, 0) and self.check_randr_sizes()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return f"RandRBindings({self.display_name})"
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_3__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_2__repr__(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_2__repr__(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2[3];
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "xpra/x11/bindings/randr.pyx":616
 * 
 *     def __repr__(self):
 *         return f"RandRBindings({self.display_name})"             # <<<<<<<<<<<<<<
 * 
 *     def get_version(self) -> Tuple[int, int]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_self->__pyx_base.display_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2[0] = __pyx_mstate_global->__pyx_kp_u_RandRBindings;
  __pyx_t_2[1] = __pyx_t_1;
  __pyx_t_2[2] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, 14 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":615
 *         self._has_randr = self.version > (1, 0) and self.check_randr_sizes()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return f"RandRBindings({self.display_name})"
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":618
 *         return f"RandRBindings({self.display_name})"
 * 
 *     def get_version(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         return self.version
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_5get_version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_5get_version = {"get_version", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_5get_version, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_5get_version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_version (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_4get_version(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_4get_version(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_version", 0);

  /* "xpra/x11/bindings/randr.pyx":619
 * 
 *     def get_version(self) -> Tuple[int, int]:
 *         return self.version             # <<<<<<<<<<<<<<
 * 
 *     def check_randr_sizes(self) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->version;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 619, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":618
 *         return f"RandRBindings({self.display_name})"
 * 
 *     def get_version(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         return self.version
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":621
 *         return self.version
 * 
 *     def check_randr_sizes(self) -> bool:             # <<<<<<<<<<<<<<
 *         #check for wayland, which has no sizes:
 *         #(and we wouldn't be able to set screen resolutions)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_7check_randr_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_7check_randr_sizes = {"check_randr_sizes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_7check_randr_sizes, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_7check_randr_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_randr_sizes (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_6check_randr_sizes(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_6check_randr_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenConfiguration *__pyx_v_config;
  int __pyx_v_num_sizes;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[3];
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_randr_sizes", 0);

  /* "xpra/x11/bindings/randr.pyx":624
 *         #check for wayland, which has no sizes:
 *         #(and we wouldn't be able to set screen resolutions)
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":625
 *         #(and we wouldn't be able to set screen resolutions)
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)             # <<<<<<<<<<<<<<
 *         if config==NULL:
 *             log("check_randr_sizes: failed to get randr screen info")
*/
  __pyx_v_config = XRRGetScreenInfo(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":626
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:             # <<<<<<<<<<<<<<
 *             log("check_randr_sizes: failed to get randr screen info")
 *             return False
*/
  __pyx_t_1 = (__pyx_v_config == NULL);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":627
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:
 *             log("check_randr_sizes: failed to get randr screen info")             # <<<<<<<<<<<<<<
 *             return False
 *         cdef int num_sizes = 0
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_check_randr_sizes_failed_to_get};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":628
 *         if config==NULL:
 *             log("check_randr_sizes: failed to get randr screen info")
 *             return False             # <<<<<<<<<<<<<<
 *         cdef int num_sizes = 0
 *         XRRConfigSizes(config, &num_sizes)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":626
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:             # <<<<<<<<<<<<<<
 *             log("check_randr_sizes: failed to get randr screen info")
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":629
 *             log("check_randr_sizes: failed to get randr screen info")
 *             return False
 *         cdef int num_sizes = 0             # <<<<<<<<<<<<<<
 *         XRRConfigSizes(config, &num_sizes)
 *         log(f"found {num_sizes} screen sizes")
*/
  __pyx_v_num_sizes = 0;

  /* "xpra/x11/bindings/randr.pyx":630
 *             return False
 *         cdef int num_sizes = 0
 *         XRRConfigSizes(config, &num_sizes)             # <<<<<<<<<<<<<<
 *         log(f"found {num_sizes} screen sizes")
 *         return num_sizes > 0
*/
  (void)(XRRConfigSizes(__pyx_v_config, (&__pyx_v_num_sizes)));

  /* "xpra/x11/bindings/randr.pyx":631
 *         cdef int num_sizes = 0
 *         XRRConfigSizes(config, &num_sizes)
 *         log(f"found {num_sizes} screen sizes")             # <<<<<<<<<<<<<<
 *         return num_sizes > 0
 * 
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_num_sizes, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_found;
  __pyx_t_7[1] = __pyx_t_6;
  __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_screen_sizes;
  __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 13, 127);
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":632
 *         XRRConfigSizes(config, &num_sizes)
 *         log(f"found {num_sizes} screen sizes")
 *         return num_sizes > 0             # <<<<<<<<<<<<<<
 * 
 *     def has_randr(self) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_num_sizes > 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":621
 *         return self.version
 * 
 *     def check_randr_sizes(self) -> bool:             # <<<<<<<<<<<<<<
 *         #check for wayland, which has no sizes:
 *         #(and we wouldn't be able to set screen resolutions)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.check_randr_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":634
 *         return num_sizes > 0
 * 
 *     def has_randr(self) -> bool:             # <<<<<<<<<<<<<<
 *         return bool(self._has_randr)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_9has_randr(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_9has_randr = {"has_randr", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_9has_randr, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_9has_randr(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_randr (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_8has_randr(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_8has_randr(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_randr", 0);

  /* "xpra/x11/bindings/randr.pyx":635
 * 
 *     def has_randr(self) -> bool:
 *         return bool(self._has_randr)             # <<<<<<<<<<<<<<
 * 
 *     def select_screen_changes(self) -> None:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((!(!(__pyx_v_self->_has_randr != 0)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":634
 *         return num_sizes > 0
 * 
 *     def has_randr(self) -> bool:             # <<<<<<<<<<<<<<
 *         return bool(self._has_randr)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.has_randr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":637
 *         return bool(self._has_randr)
 * 
 *     def select_screen_changes(self) -> None:             # <<<<<<<<<<<<<<
 *         cdef int mask = RRScreenChangeNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_11select_screen_changes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_11select_screen_changes = {"select_screen_changes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_11select_screen_changes, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_11select_screen_changes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_screen_changes (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_10select_screen_changes(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_10select_screen_changes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  int __pyx_v_mask;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_root;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_screen_changes", 0);

  /* "xpra/x11/bindings/randr.pyx":638
 * 
 *     def select_screen_changes(self) -> None:
 *         cdef int mask = RRScreenChangeNotifyMask             # <<<<<<<<<<<<<<
 *         cdef Window root = XDefaultRootWindow(self.display)
 *         XRRSelectInput(self.display, root, mask)
*/
  __pyx_v_mask = RRScreenChangeNotifyMask;

  /* "xpra/x11/bindings/randr.pyx":639
 *     def select_screen_changes(self) -> None:
 *         cdef int mask = RRScreenChangeNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         XRRSelectInput(self.display, root, mask)
 * 
*/
  __pyx_v_root = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":640
 *         cdef int mask = RRScreenChangeNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
 *         XRRSelectInput(self.display, root, mask)             # <<<<<<<<<<<<<<
 * 
 *     def select_crtc_output_changes(self) -> None:
*/
  XRRSelectInput(__pyx_v_self->__pyx_base.display, __pyx_v_root, __pyx_v_mask);

  /* "xpra/x11/bindings/randr.pyx":637
 *         return bool(self._has_randr)
 * 
 *     def select_screen_changes(self) -> None:             # <<<<<<<<<<<<<<
 *         cdef int mask = RRScreenChangeNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":642
 *         XRRSelectInput(self.display, root, mask)
 * 
 *     def select_crtc_output_changes(self) -> None:             # <<<<<<<<<<<<<<
 *         cdef int mask = RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_13select_crtc_output_changes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_13select_crtc_output_changes = {"select_crtc_output_changes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_13select_crtc_output_changes, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_13select_crtc_output_changes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_crtc_output_changes (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_12select_crtc_output_changes(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_12select_crtc_output_changes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  int __pyx_v_mask;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_root;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_crtc_output_changes", 0);

  /* "xpra/x11/bindings/randr.pyx":643
 * 
 *     def select_crtc_output_changes(self) -> None:
 *         cdef int mask = RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask             # <<<<<<<<<<<<<<
 *         cdef Window root = XDefaultRootWindow(self.display)
 *         XRRSelectInput(self.display, root, mask)
*/
  __pyx_v_mask = (((RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask) | RROutputChangeNotifyMask) | RROutputPropertyNotifyMask);

  /* "xpra/x11/bindings/randr.pyx":644
 *     def select_crtc_output_changes(self) -> None:
 *         cdef int mask = RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         XRRSelectInput(self.display, root, mask)
 * 
*/
  __pyx_v_root = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":645
 *         cdef int mask = RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
 *         XRRSelectInput(self.display, root, mask)             # <<<<<<<<<<<<<<
 * 
 *     cdef List _get_xrr_screen_sizes(self):
*/
  XRRSelectInput(__pyx_v_self->__pyx_base.display, __pyx_v_root, __pyx_v_mask);

  /* "xpra/x11/bindings/randr.pyx":642
 *         XRRSelectInput(self.display, root, mask)
 * 
 *     def select_crtc_output_changes(self) -> None:             # <<<<<<<<<<<<<<
 *         cdef int mask = RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":647
 *         XRRSelectInput(self.display, root, mask)
 * 
 *     cdef List _get_xrr_screen_sizes(self):             # <<<<<<<<<<<<<<
 *         cdef int num_sizes = 0
 *         cdef XRRScreenSize xrr
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance__get_xrr_screen_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  int __pyx_v_num_sizes;
  XRRScreenSize __pyx_v_xrr;
  XRRScreenSize *__pyx_v_xrrs;
  PyObject *__pyx_v_sizes = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_xrr_screen_sizes", 0);

  /* "xpra/x11/bindings/randr.pyx":648
 * 
 *     cdef List _get_xrr_screen_sizes(self):
 *         cdef int num_sizes = 0             # <<<<<<<<<<<<<<
 *         cdef XRRScreenSize xrr
 *         cdef XRRScreenSize *xrrs = XRRSizes(self.display, 0, &num_sizes)
*/
  __pyx_v_num_sizes = 0;

  /* "xpra/x11/bindings/randr.pyx":650
 *         cdef int num_sizes = 0
 *         cdef XRRScreenSize xrr
 *         cdef XRRScreenSize *xrrs = XRRSizes(self.display, 0, &num_sizes)             # <<<<<<<<<<<<<<
 *         sizes = []
 *         if xrrs==NULL:
*/
  __pyx_v_xrrs = XRRSizes(__pyx_v_self->__pyx_base.display, 0, (&__pyx_v_num_sizes));

  /* "xpra/x11/bindings/randr.pyx":651
 *         cdef XRRScreenSize xrr
 *         cdef XRRScreenSize *xrrs = XRRSizes(self.display, 0, &num_sizes)
 *         sizes = []             # <<<<<<<<<<<<<<
 *         if xrrs==NULL:
 *             return sizes
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sizes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":652
 *         cdef XRRScreenSize *xrrs = XRRSizes(self.display, 0, &num_sizes)
 *         sizes = []
 *         if xrrs==NULL:             # <<<<<<<<<<<<<<
 *             return sizes
 *         for i in range(num_sizes):
*/
  __pyx_t_2 = (__pyx_v_xrrs == NULL);
  if (__pyx_t_2) {

    /* "xpra/x11/bindings/randr.pyx":653
 *         sizes = []
 *         if xrrs==NULL:
 *             return sizes             # <<<<<<<<<<<<<<
 *         for i in range(num_sizes):
 *             xrr = xrrs[i]
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_sizes);
    __pyx_r = __pyx_v_sizes;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":652
 *         cdef XRRScreenSize *xrrs = XRRSizes(self.display, 0, &num_sizes)
 *         sizes = []
 *         if xrrs==NULL:             # <<<<<<<<<<<<<<
 *             return sizes
 *         for i in range(num_sizes):
*/
  }

  /* "xpra/x11/bindings/randr.pyx":654
 *         if xrrs==NULL:
 *             return sizes
 *         for i in range(num_sizes):             # <<<<<<<<<<<<<<
 *             xrr = xrrs[i]
 *             sizes.append((xrr.width, xrr.height))
*/
  __pyx_t_3 = __pyx_v_num_sizes;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "xpra/x11/bindings/randr.pyx":655
 *             return sizes
 *         for i in range(num_sizes):
 *             xrr = xrrs[i]             # <<<<<<<<<<<<<<
 *             sizes.append((xrr.width, xrr.height))
 *         return sizes
*/
    __pyx_v_xrr = (__pyx_v_xrrs[__pyx_v_i]);

    /* "xpra/x11/bindings/randr.pyx":656
 *         for i in range(num_sizes):
 *             xrr = xrrs[i]
 *             sizes.append((xrr.width, xrr.height))             # <<<<<<<<<<<<<<
 *         return sizes
 * 
*/
    __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_xrr.width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_xrr.height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 656, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 656, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_sizes, __pyx_t_7); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }

  /* "xpra/x11/bindings/randr.pyx":657
 *             xrr = xrrs[i]
 *             sizes.append((xrr.width, xrr.height))
 *         return sizes             # <<<<<<<<<<<<<<
 * 
 *     def get_xrr_screen_sizes(self) -> List[Tuple[int, int]]:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sizes);
  __pyx_r = __pyx_v_sizes;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":647
 *         XRRSelectInput(self.display, root, mask)
 * 
 *     cdef List _get_xrr_screen_sizes(self):             # <<<<<<<<<<<<<<
 *         cdef int num_sizes = 0
 *         cdef XRRScreenSize xrr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance._get_xrr_screen_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":659
 *         return sizes
 * 
 *     def get_xrr_screen_sizes(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         v = self._get_xrr_screen_sizes()
 *         log(f"get_xrr_screen_sizes()={v}")
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15get_xrr_screen_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15get_xrr_screen_sizes = {"get_xrr_screen_sizes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15get_xrr_screen_sizes, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15get_xrr_screen_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_xrr_screen_sizes (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_14get_xrr_screen_sizes(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_14get_xrr_screen_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_xrr_screen_sizes", 0);

  /* "xpra/x11/bindings/randr.pyx":660
 * 
 *     def get_xrr_screen_sizes(self) -> List[Tuple[int, int]]:
 *         v = self._get_xrr_screen_sizes()             # <<<<<<<<<<<<<<
 *         log(f"get_xrr_screen_sizes()={v}")
 *         return v
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_xrr_screen_sizes(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_v = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":661
 *     def get_xrr_screen_sizes(self) -> List[Tuple[int, int]]:
 *         v = self._get_xrr_screen_sizes()
 *         log(f"get_xrr_screen_sizes()={v}")             # <<<<<<<<<<<<<<
 *         return v
 * 
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_v, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_get_xrr_screen_sizes, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":662
 *         v = self._get_xrr_screen_sizes()
 *         log(f"get_xrr_screen_sizes()={v}")
 *         return v             # <<<<<<<<<<<<<<
 * 
 *     cdef int _set_screen_size(self, width, height):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_v);
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":659
 *         return sizes
 * 
 *     def get_xrr_screen_sizes(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         v = self._get_xrr_screen_sizes()
 *         log(f"get_xrr_screen_sizes()={v}")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_xrr_screen_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_2generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "xpra/x11/bindings/randr.pyx":713
 *                     log.error(f" {num_sizes} sizes are supported")
 *                     if num_sizes<=16:
 *                         log.error(" %s", csv(f"{w}x{h}" for w, h in sizes))             # <<<<<<<<<<<<<<
 *                     else:
 *                         log(f"sizes found: {csv(sizes)}")
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 713, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_2generator8, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance__set_scree, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr); if (unlikely(!gen)) __PYX_ERR(0, 713, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance._set_screen_size.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_2generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 713, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 713, __pyx_L1_error) }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 713, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 713, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_5);
      } else {
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
      }
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < (0)) __PYX_ERR(0, 713, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 713, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_w);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_w, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_h);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_h, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_w, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_h, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8[0] = __pyx_t_3;
    __pyx_t_8[1] = __pyx_mstate_global->__pyx_n_u_x;
    __pyx_t_8[2] = __pyx_t_5;
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L8_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 713, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":664
 *         return v
 * 
 *     cdef int _set_screen_size(self, width, height):             # <<<<<<<<<<<<<<
 *         self.context_check("set-screen-size")
 *         cdef int num_sizes = 0
*/

static int __pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance__set_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height) {
  int __pyx_v_num_sizes;
  int __pyx_v_num_rates;
  short *__pyx_v_rates;
  short __pyx_v_rate;
  Rotation __pyx_v_rotation;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Time __pyx_v_time;
  int __pyx_v_sizeID;
  XRRScreenSize *__pyx_v_xrrs;
  XRRScreenSize __pyx_v_xrr;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenConfiguration *__pyx_v_config;
  PyObject *__pyx_v_sizes = NULL;
  PyObject *__pyx_v_oversize = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_extra = NULL;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Status __pyx_v_status;
  PyObject *__pyx_gb_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_2generator8 = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[4];
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15[3];
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  char const *__pyx_t_21;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_screen_size", 0);

  /* "xpra/x11/bindings/randr.pyx":665
 * 
 *     cdef int _set_screen_size(self, width, height):
 *         self.context_check("set-screen-size")             # <<<<<<<<<<<<<<
 *         cdef int num_sizes = 0
 *         cdef int num_rates = 0
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_set_screen_size};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":666
 *     cdef int _set_screen_size(self, width, height):
 *         self.context_check("set-screen-size")
 *         cdef int num_sizes = 0             # <<<<<<<<<<<<<<
 *         cdef int num_rates = 0
 *         cdef short* rates = <short*> 0
*/
  __pyx_v_num_sizes = 0;

  /* "xpra/x11/bindings/randr.pyx":667
 *         self.context_check("set-screen-size")
 *         cdef int num_sizes = 0
 *         cdef int num_rates = 0             # <<<<<<<<<<<<<<
 *         cdef short* rates = <short*> 0
 *         cdef short rate = 0
*/
  __pyx_v_num_rates = 0;

  /* "xpra/x11/bindings/randr.pyx":668
 *         cdef int num_sizes = 0
 *         cdef int num_rates = 0
 *         cdef short* rates = <short*> 0             # <<<<<<<<<<<<<<
 *         cdef short rate = 0
 *         cdef Rotation rotation = 0
*/
  __pyx_v_rates = ((short *)0);

  /* "xpra/x11/bindings/randr.pyx":669
 *         cdef int num_rates = 0
 *         cdef short* rates = <short*> 0
 *         cdef short rate = 0             # <<<<<<<<<<<<<<
 *         cdef Rotation rotation = 0
 *         cdef Time time = 0
*/
  __pyx_v_rate = 0;

  /* "xpra/x11/bindings/randr.pyx":670
 *         cdef short* rates = <short*> 0
 *         cdef short rate = 0
 *         cdef Rotation rotation = 0             # <<<<<<<<<<<<<<
 *         cdef Time time = 0
 *         cdef int sizeID = 0
*/
  __pyx_v_rotation = 0;

  /* "xpra/x11/bindings/randr.pyx":671
 *         cdef short rate = 0
 *         cdef Rotation rotation = 0
 *         cdef Time time = 0             # <<<<<<<<<<<<<<
 *         cdef int sizeID = 0
 *         cdef XRRScreenSize *xrrs
*/
  __pyx_v_time = 0;

  /* "xpra/x11/bindings/randr.pyx":672
 *         cdef Rotation rotation = 0
 *         cdef Time time = 0
 *         cdef int sizeID = 0             # <<<<<<<<<<<<<<
 *         cdef XRRScreenSize *xrrs
 *         cdef XRRScreenSize xrr
*/
  __pyx_v_sizeID = 0;

  /* "xpra/x11/bindings/randr.pyx":676
 *         cdef XRRScreenSize xrr
 * 
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":677
 * 
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)             # <<<<<<<<<<<<<<
 *         if config==NULL:
 *             log.error("Error: failed to get randr screen info")
*/
  __pyx_v_config = XRRGetScreenInfo(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":678
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: failed to get randr screen info")
 *             return False
*/
  __pyx_t_4 = (__pyx_v_config == NULL);
  if (__pyx_t_4) {

    /* "xpra/x11/bindings/randr.pyx":679
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:
 *             log.error("Error: failed to get randr screen info")             # <<<<<<<<<<<<<<
 *             return False
 *         try:
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_get_randr_screen};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":680
 *         if config==NULL:
 *             log.error("Error: failed to get randr screen info")
 *             return False             # <<<<<<<<<<<<<<
 *         try:
 *             xrrs = XRRConfigSizes(config, &num_sizes)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":678
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: failed to get randr screen info")
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":681
 *             log.error("Error: failed to get randr screen info")
 *             return False
 *         try:             # <<<<<<<<<<<<<<
 *             xrrs = XRRConfigSizes(config, &num_sizes)
 *             if xrrs==NULL:
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":682
 *             return False
 *         try:
 *             xrrs = XRRConfigSizes(config, &num_sizes)             # <<<<<<<<<<<<<<
 *             if xrrs==NULL:
 *                 log.error("Error: failed to get randr screen sizes")
*/
    __pyx_v_xrrs = XRRConfigSizes(__pyx_v_config, (&__pyx_v_num_sizes));

    /* "xpra/x11/bindings/randr.pyx":683
 *         try:
 *             xrrs = XRRConfigSizes(config, &num_sizes)
 *             if xrrs==NULL:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to get randr screen sizes")
 *                 return False
*/
    __pyx_t_4 = (__pyx_v_xrrs == NULL);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":684
 *             xrrs = XRRConfigSizes(config, &num_sizes)
 *             if xrrs==NULL:
 *                 log.error("Error: failed to get randr screen sizes")             # <<<<<<<<<<<<<<
 *                 return False
 *             if num_sizes==0:
*/
      __pyx_t_6 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 684, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_6);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_get_randr_screen_2};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":685
 *             if xrrs==NULL:
 *                 log.error("Error: failed to get randr screen sizes")
 *                 return False             # <<<<<<<<<<<<<<
 *             if num_sizes==0:
 *                 if first_time("no-randr-sizes"):
*/
      __pyx_r = 0;
      goto __pyx_L4_return;

      /* "xpra/x11/bindings/randr.pyx":683
 *         try:
 *             xrrs = XRRConfigSizes(config, &num_sizes)
 *             if xrrs==NULL:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to get randr screen sizes")
 *                 return False
*/
    }

    /* "xpra/x11/bindings/randr.pyx":686
 *                 log.error("Error: failed to get randr screen sizes")
 *                 return False
 *             if num_sizes==0:             # <<<<<<<<<<<<<<
 *                 if first_time("no-randr-sizes"):
 *                     log.warn("Warning: no randr sizes found")
*/
    __pyx_t_4 = (__pyx_v_num_sizes == 0);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":687
 *                 return False
 *             if num_sizes==0:
 *                 if first_time("no-randr-sizes"):             # <<<<<<<<<<<<<<
 *                     log.warn("Warning: no randr sizes found")
 *                     log.warn(f" cannot set screen size to match {width}x{height}")
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_first_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 687, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_no_randr_sizes};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 687, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_4) {

        /* "xpra/x11/bindings/randr.pyx":688
 *             if num_sizes==0:
 *                 if first_time("no-randr-sizes"):
 *                     log.warn("Warning: no randr sizes found")             # <<<<<<<<<<<<<<
 *                     log.warn(f" cannot set screen size to match {width}x{height}")
 *                 else:
*/
        __pyx_t_6 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 688, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
          assert(__pyx_t_6);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Warning_no_randr_sizes_found};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":689
 *                 if first_time("no-randr-sizes"):
 *                     log.warn("Warning: no randr sizes found")
 *                     log.warn(f" cannot set screen size to match {width}x{height}")             # <<<<<<<<<<<<<<
 *                 else:
 *                     log("no randr sizes")
*/
        __pyx_t_2 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 689, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_width, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_height, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 689, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_cannot_set_screen_size_to_match;
        __pyx_t_8[1] = __pyx_t_6;
        __pyx_t_8[2] = __pyx_mstate_global->__pyx_n_u_x;
        __pyx_t_8[3] = __pyx_t_7;
        __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, 33 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 689, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_2);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_9};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":687
 *                 return False
 *             if num_sizes==0:
 *                 if first_time("no-randr-sizes"):             # <<<<<<<<<<<<<<
 *                     log.warn("Warning: no randr sizes found")
 *                     log.warn(f" cannot set screen size to match {width}x{height}")
*/
        goto __pyx_L9;
      }

      /* "xpra/x11/bindings/randr.pyx":691
 *                     log.warn(f" cannot set screen size to match {width}x{height}")
 *                 else:
 *                     log("no randr sizes")             # <<<<<<<<<<<<<<
 *                 return False
 *             sizes = []
*/
      /*else*/ {
        __pyx_t_5 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 691, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_no_randr_sizes_2};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L9:;

      /* "xpra/x11/bindings/randr.pyx":692
 *                 else:
 *                     log("no randr sizes")
 *                 return False             # <<<<<<<<<<<<<<
 *             sizes = []
 *             sizeID = -1
*/
      __pyx_r = 0;
      goto __pyx_L4_return;

      /* "xpra/x11/bindings/randr.pyx":686
 *                 log.error("Error: failed to get randr screen sizes")
 *                 return False
 *             if num_sizes==0:             # <<<<<<<<<<<<<<
 *                 if first_time("no-randr-sizes"):
 *                     log.warn("Warning: no randr sizes found")
*/
    }

    /* "xpra/x11/bindings/randr.pyx":693
 *                     log("no randr sizes")
 *                 return False
 *             sizes = []             # <<<<<<<<<<<<<<
 *             sizeID = -1
 *             oversize = {}
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_sizes = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":694
 *                 return False
 *             sizes = []
 *             sizeID = -1             # <<<<<<<<<<<<<<
 *             oversize = {}
 *             for i in range(num_sizes):
*/
    __pyx_v_sizeID = -1;

    /* "xpra/x11/bindings/randr.pyx":695
 *             sizes = []
 *             sizeID = -1
 *             oversize = {}             # <<<<<<<<<<<<<<
 *             for i in range(num_sizes):
 *                 xrr = xrrs[i]
*/
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_oversize = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":696
 *             sizeID = -1
 *             oversize = {}
 *             for i in range(num_sizes):             # <<<<<<<<<<<<<<
 *                 xrr = xrrs[i]
 *                 sizes.append((int(xrr.width), int(xrr.height)))
*/
    __pyx_t_10 = __pyx_v_num_sizes;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;

      /* "xpra/x11/bindings/randr.pyx":697
 *             oversize = {}
 *             for i in range(num_sizes):
 *                 xrr = xrrs[i]             # <<<<<<<<<<<<<<
 *                 sizes.append((int(xrr.width), int(xrr.height)))
 *                 if xrr.width==width and xrr.height==height:
*/
      __pyx_v_xrr = (__pyx_v_xrrs[__pyx_v_i]);

      /* "xpra/x11/bindings/randr.pyx":698
 *             for i in range(num_sizes):
 *                 xrr = xrrs[i]
 *                 sizes.append((int(xrr.width), int(xrr.height)))             # <<<<<<<<<<<<<<
 *                 if xrr.width==width and xrr.height==height:
 *                     sizeID = i
*/
      __pyx_t_9 = NULL;
      __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_xrr.width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_9 = NULL;
      __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_xrr.height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_2};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 698, __pyx_L5_error);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 698, __pyx_L5_error);
      __pyx_t_1 = 0;
      __pyx_t_5 = 0;
      __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_sizes, __pyx_t_2); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 698, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "xpra/x11/bindings/randr.pyx":699
 *                 xrr = xrrs[i]
 *                 sizes.append((int(xrr.width), int(xrr.height)))
 *                 if xrr.width==width and xrr.height==height:             # <<<<<<<<<<<<<<
 *                     sizeID = i
 *                 elif xrr.width>=width and xrr.height>=height:
*/
      __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_xrr.width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_v_width, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 699, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_14) {
      } else {
        __pyx_t_4 = __pyx_t_14;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_xrr.height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_v_height, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 699, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __pyx_t_14;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_4) {

        /* "xpra/x11/bindings/randr.pyx":700
 *                 sizes.append((int(xrr.width), int(xrr.height)))
 *                 if xrr.width==width and xrr.height==height:
 *                     sizeID = i             # <<<<<<<<<<<<<<
 *                 elif xrr.width>=width and xrr.height>=height:
 *                     extra = xrr.width*xrr.height - width*height
*/
        __pyx_v_sizeID = __pyx_v_i;

        /* "xpra/x11/bindings/randr.pyx":699
 *                 xrr = xrrs[i]
 *                 sizes.append((int(xrr.width), int(xrr.height)))
 *                 if xrr.width==width and xrr.height==height:             # <<<<<<<<<<<<<<
 *                     sizeID = i
 *                 elif xrr.width>=width and xrr.height>=height:
*/
        goto __pyx_L12;
      }

      /* "xpra/x11/bindings/randr.pyx":701
 *                 if xrr.width==width and xrr.height==height:
 *                     sizeID = i
 *                 elif xrr.width>=width and xrr.height>=height:             # <<<<<<<<<<<<<<
 *                     extra = xrr.width*xrr.height - width*height
 *                     oversize[extra] = i
*/
      __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_xrr.width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_v_width, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 701, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_14) {
      } else {
        __pyx_t_4 = __pyx_t_14;
        goto __pyx_L15_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_xrr.height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_v_height, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 701, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __pyx_t_14;
      __pyx_L15_bool_binop_done:;
      if (__pyx_t_4) {

        /* "xpra/x11/bindings/randr.pyx":702
 *                     sizeID = i
 *                 elif xrr.width>=width and xrr.height>=height:
 *                     extra = xrr.width*xrr.height - width*height             # <<<<<<<<<<<<<<
 *                     oversize[extra] = i
 *             if sizeID<0:
*/
        __pyx_t_2 = __Pyx_PyLong_From_int((__pyx_v_xrr.width * __pyx_v_xrr.height)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = PyNumber_Multiply(__pyx_v_width, __pyx_v_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_extra, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":703
 *                 elif xrr.width>=width and xrr.height>=height:
 *                     extra = xrr.width*xrr.height - width*height
 *                     oversize[extra] = i             # <<<<<<<<<<<<<<
 *             if sizeID<0:
 *                 if oversize:
*/
        __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely((PyDict_SetItem(__pyx_v_oversize, __pyx_v_extra, __pyx_t_1) < 0))) __PYX_ERR(0, 703, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":701
 *                 if xrr.width==width and xrr.height==height:
 *                     sizeID = i
 *                 elif xrr.width>=width and xrr.height>=height:             # <<<<<<<<<<<<<<
 *                     extra = xrr.width*xrr.height - width*height
 *                     oversize[extra] = i
*/
      }
      __pyx_L12:;
    }

    /* "xpra/x11/bindings/randr.pyx":704
 *                     extra = xrr.width*xrr.height - width*height
 *                     oversize[extra] = i
 *             if sizeID<0:             # <<<<<<<<<<<<<<
 *                 if oversize:
 *                     #choose the next highest:
*/
    __pyx_t_4 = (__pyx_v_sizeID < 0);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":705
 *                     oversize[extra] = i
 *             if sizeID<0:
 *                 if oversize:             # <<<<<<<<<<<<<<
 *                     #choose the next highest:
 *                     extra = sorted(oversize.keys())[0]
*/
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_oversize); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 705, __pyx_L5_error)
      if (__pyx_t_4) {

        /* "xpra/x11/bindings/randr.pyx":707
 *                 if oversize:
 *                     #choose the next highest:
 *                     extra = sorted(oversize.keys())[0]             # <<<<<<<<<<<<<<
 *                     sizeID = oversize[extra]
 *                 else:
*/
        __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_oversize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 707, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely((PyList_Sort(__pyx_t_5) < 0))) __PYX_ERR(0, 707, __pyx_L5_error)
        __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_t_5, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_extra, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":708
 *                     #choose the next highest:
 *                     extra = sorted(oversize.keys())[0]
 *                     sizeID = oversize[extra]             # <<<<<<<<<<<<<<
 *                 else:
 *                     log.error(f"Error: size not found for {width}x{height}")
*/
        __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_oversize, __pyx_v_extra); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 708, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_sizeID = __pyx_t_10;

        /* "xpra/x11/bindings/randr.pyx":705
 *                     oversize[extra] = i
 *             if sizeID<0:
 *                 if oversize:             # <<<<<<<<<<<<<<
 *                     #choose the next highest:
 *                     extra = sorted(oversize.keys())[0]
*/
        goto __pyx_L18;
      }

      /* "xpra/x11/bindings/randr.pyx":710
 *                     sizeID = oversize[extra]
 *                 else:
 *                     log.error(f"Error: size not found for {width}x{height}")             # <<<<<<<<<<<<<<
 *                     log.error(f" {num_sizes} sizes are supported")
 *                     if num_sizes<=16:
*/
      /*else*/ {
        __pyx_t_5 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 710, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 710, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_width, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 710, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_height, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 710, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_Error_size_not_found_for;
        __pyx_t_8[1] = __pyx_t_2;
        __pyx_t_8[2] = __pyx_mstate_global->__pyx_n_u_x;
        __pyx_t_8[3] = __pyx_t_7;
        __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 710, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 710, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":711
 *                 else:
 *                     log.error(f"Error: size not found for {width}x{height}")
 *                     log.error(f" {num_sizes} sizes are supported")             # <<<<<<<<<<<<<<
 *                     if num_sizes<=16:
 *                         log.error(" %s", csv(f"{w}x{h}" for w, h in sizes))
*/
        __pyx_t_9 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 711, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 711, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_num_sizes, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 711, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_15[0] = __pyx_mstate_global->__pyx_kp_u__6;
        __pyx_t_15[1] = __pyx_t_6;
        __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u_sizes_are_supported;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 20, 127);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 711, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_9);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":712
 *                     log.error(f"Error: size not found for {width}x{height}")
 *                     log.error(f" {num_sizes} sizes are supported")
 *                     if num_sizes<=16:             # <<<<<<<<<<<<<<
 *                         log.error(" %s", csv(f"{w}x{h}" for w, h in sizes))
 *                     else:
*/
        __pyx_t_4 = (__pyx_v_num_sizes <= 16);
        if (__pyx_t_4) {

          /* "xpra/x11/bindings/randr.pyx":713
 *                     log.error(f" {num_sizes} sizes are supported")
 *                     if num_sizes<=16:
 *                         log.error(" %s", csv(f"{w}x{h}" for w, h in sizes))             # <<<<<<<<<<<<<<
 *                     else:
 *                         log(f"sizes found: {csv(sizes)}")
*/
          __pyx_t_5 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 713, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 713, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_6 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_csv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_16 = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_genexpr(NULL, __pyx_v_sizes); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 713, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
            assert(__pyx_t_6);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_16};
            __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 713, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
            assert(__pyx_t_5);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_s_2, __pyx_t_7};
            __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "xpra/x11/bindings/randr.pyx":712
 *                     log.error(f"Error: size not found for {width}x{height}")
 *                     log.error(f" {num_sizes} sizes are supported")
 *                     if num_sizes<=16:             # <<<<<<<<<<<<<<
 *                         log.error(" %s", csv(f"{w}x{h}" for w, h in sizes))
 *                     else:
*/
          goto __pyx_L19;
        }

        /* "xpra/x11/bindings/randr.pyx":715
 *                         log.error(" %s", csv(f"{w}x{h}" for w, h in sizes))
 *                     else:
 *                         log(f"sizes found: {csv(sizes)}")             # <<<<<<<<<<<<<<
 *                     return False
 *             rates = XRRConfigRates(config, sizeID, &num_rates)
*/
        /*else*/ {
          __pyx_t_9 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 715, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_csv); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 715, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_16))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
            assert(__pyx_t_2);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_16, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_sizes};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 715, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_sizes_found, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
            assert(__pyx_t_9);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_5};
            __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __pyx_L19:;

        /* "xpra/x11/bindings/randr.pyx":716
 *                     else:
 *                         log(f"sizes found: {csv(sizes)}")
 *                     return False             # <<<<<<<<<<<<<<
 *             rates = XRRConfigRates(config, sizeID, &num_rates)
 *             if rates==NULL:
*/
        __pyx_r = 0;
        goto __pyx_L4_return;
      }
      __pyx_L18:;

      /* "xpra/x11/bindings/randr.pyx":704
 *                     extra = xrr.width*xrr.height - width*height
 *                     oversize[extra] = i
 *             if sizeID<0:             # <<<<<<<<<<<<<<
 *                 if oversize:
 *                     #choose the next highest:
*/
    }

    /* "xpra/x11/bindings/randr.pyx":717
 *                         log(f"sizes found: {csv(sizes)}")
 *                     return False
 *             rates = XRRConfigRates(config, sizeID, &num_rates)             # <<<<<<<<<<<<<<
 *             if rates==NULL:
 *                 log.error("Error: failed to get randr config rates")
*/
    __pyx_v_rates = XRRConfigRates(__pyx_v_config, __pyx_v_sizeID, (&__pyx_v_num_rates));

    /* "xpra/x11/bindings/randr.pyx":718
 *                     return False
 *             rates = XRRConfigRates(config, sizeID, &num_rates)
 *             if rates==NULL:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to get randr config rates")
 *                 return False
*/
    __pyx_t_4 = (__pyx_v_rates == NULL);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":719
 *             rates = XRRConfigRates(config, sizeID, &num_rates)
 *             if rates==NULL:
 *                 log.error("Error: failed to get randr config rates")             # <<<<<<<<<<<<<<
 *                 return False
 *             rate = rates[0]
*/
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 719, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 719, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_get_randr_config};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":720
 *             if rates==NULL:
 *                 log.error("Error: failed to get randr config rates")
 *                 return False             # <<<<<<<<<<<<<<
 *             rate = rates[0]
 *             rotation = RR_Rotate_0
*/
      __pyx_r = 0;
      goto __pyx_L4_return;

      /* "xpra/x11/bindings/randr.pyx":718
 *                     return False
 *             rates = XRRConfigRates(config, sizeID, &num_rates)
 *             if rates==NULL:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to get randr config rates")
 *                 return False
*/
    }

    /* "xpra/x11/bindings/randr.pyx":721
 *                 log.error("Error: failed to get randr config rates")
 *                 return False
 *             rate = rates[0]             # <<<<<<<<<<<<<<
 *             rotation = RR_Rotate_0
 *             time = CurrentTime
*/
    __pyx_v_rate = (__pyx_v_rates[0]);

    /* "xpra/x11/bindings/randr.pyx":722
 *                 return False
 *             rate = rates[0]
 *             rotation = RR_Rotate_0             # <<<<<<<<<<<<<<
 *             time = CurrentTime
 *             status = XRRSetScreenConfigAndRate(self.display, config, window, sizeID, rotation, rate, time)
*/
    __pyx_v_rotation = RR_Rotate_0;

    /* "xpra/x11/bindings/randr.pyx":723
 *             rate = rates[0]
 *             rotation = RR_Rotate_0
 *             time = CurrentTime             # <<<<<<<<<<<<<<
 *             status = XRRSetScreenConfigAndRate(self.display, config, window, sizeID, rotation, rate, time)
 *             log("XRRSetScreenConfigAndRate%s=%s", (<uintptr_t> self.display, <uintptr_t> config, window, sizeID, rotation, rate, time), status)
*/
    __pyx_v_time = CurrentTime;

    /* "xpra/x11/bindings/randr.pyx":724
 *             rotation = RR_Rotate_0
 *             time = CurrentTime
 *             status = XRRSetScreenConfigAndRate(self.display, config, window, sizeID, rotation, rate, time)             # <<<<<<<<<<<<<<
 *             log("XRRSetScreenConfigAndRate%s=%s", (<uintptr_t> self.display, <uintptr_t> config, window, sizeID, rotation, rate, time), status)
 *             if status != Success:
*/
    __pyx_v_status = XRRSetScreenConfigAndRate(__pyx_v_self->__pyx_base.display, __pyx_v_config, __pyx_v_window, __pyx_v_sizeID, __pyx_v_rotation, __pyx_v_rate, __pyx_v_time);

    /* "xpra/x11/bindings/randr.pyx":725
 *             time = CurrentTime
 *             status = XRRSetScreenConfigAndRate(self.display, config, window, sizeID, rotation, rate, time)
 *             log("XRRSetScreenConfigAndRate%s=%s", (<uintptr_t> self.display, <uintptr_t> config, window, sizeID, rotation, rate, time), status)             # <<<<<<<<<<<<<<
 *             if status != Success:
 *                 log.error("Error: failed to set new screen size")
*/
    __pyx_t_9 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_self->__pyx_base.display)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_config)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_window); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_sizeID); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_17 = __Pyx_PyLong_From_Rotation(__pyx_v_rotation); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_18 = __Pyx_PyLong_From_short(__pyx_v_rate); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_18);
    __pyx_t_19 = __Pyx_PyLong_From_unsigned_long(__pyx_v_time); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_20 = PyTuple_New(7); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 725, __pyx_L5_error);
    __Pyx_GIVEREF(__pyx_t_16);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_16) != (0)) __PYX_ERR(0, 725, __pyx_L5_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 725, __pyx_L5_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_t_6) != (0)) __PYX_ERR(0, 725, __pyx_L5_error);
    __Pyx_GIVEREF(__pyx_t_17);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 4, __pyx_t_17) != (0)) __PYX_ERR(0, 725, __pyx_L5_error);
    __Pyx_GIVEREF(__pyx_t_18);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 5, __pyx_t_18) != (0)) __PYX_ERR(0, 725, __pyx_L5_error);
    __Pyx_GIVEREF(__pyx_t_19);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 6, __pyx_t_19) != (0)) __PYX_ERR(0, 725, __pyx_L5_error);
    __pyx_t_5 = 0;
    __pyx_t_16 = 0;
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_17 = 0;
    __pyx_t_18 = 0;
    __pyx_t_19 = 0;
    __pyx_t_19 = __Pyx_PyLong_From_int(__pyx_v_status); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 725, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_9);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_XRRSetScreenConfigAndRate_s_s, __pyx_t_20, __pyx_t_19};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":726
 *             status = XRRSetScreenConfigAndRate(self.display, config, window, sizeID, rotation, rate, time)
 *             log("XRRSetScreenConfigAndRate%s=%s", (<uintptr_t> self.display, <uintptr_t> config, window, sizeID, rotation, rate, time), status)
 *             if status != Success:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to set new screen size")
 *                 log.error(f" XRRSetScreenConfigAndRate returned {status}")
*/
    __pyx_t_4 = (__pyx_v_status != Success);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":727
 *             log("XRRSetScreenConfigAndRate%s=%s", (<uintptr_t> self.display, <uintptr_t> config, window, sizeID, rotation, rate, time), status)
 *             if status != Success:
 *                 log.error("Error: failed to set new screen size")             # <<<<<<<<<<<<<<
 *                 log.error(f" XRRSetScreenConfigAndRate returned {status}")
 *                 return False
*/
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 727, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 727, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_20);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_20))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_20);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_20);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_20, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_set_new_screen_s};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_20, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":728
 *             if status != Success:
 *                 log.error("Error: failed to set new screen size")
 *                 log.error(f" XRRSetScreenConfigAndRate returned {status}")             # <<<<<<<<<<<<<<
 *                 return False
 *             return True
*/
      __pyx_t_20 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 728, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_status, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_XRRSetScreenConfigAndRate_retur, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 728, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_19))) {
        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
        assert(__pyx_t_20);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_19);
        __Pyx_INCREF(__pyx_t_20);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_19, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_19, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":729
 *                 log.error("Error: failed to set new screen size")
 *                 log.error(f" XRRSetScreenConfigAndRate returned {status}")
 *                 return False             # <<<<<<<<<<<<<<
 *             return True
 *         finally:
*/
      __pyx_r = 0;
      goto __pyx_L4_return;

      /* "xpra/x11/bindings/randr.pyx":726
 *             status = XRRSetScreenConfigAndRate(self.display, config, window, sizeID, rotation, rate, time)
 *             log("XRRSetScreenConfigAndRate%s=%s", (<uintptr_t> self.display, <uintptr_t> config, window, sizeID, rotation, rate, time), status)
 *             if status != Success:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to set new screen size")
 *                 log.error(f" XRRSetScreenConfigAndRate returned {status}")
*/
    }

    /* "xpra/x11/bindings/randr.pyx":730
 *                 log.error(f" XRRSetScreenConfigAndRate returned {status}")
 *                 return False
 *             return True             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenConfigInfo(config)
*/
    __pyx_r = 1;
    goto __pyx_L4_return;
  }

  /* "xpra/x11/bindings/randr.pyx":732
 *             return True
 *         finally:
 *             XRRFreeScreenConfigInfo(config)             # <<<<<<<<<<<<<<
 * 
 *     def get_screen_count(self) -> int:
*/
  /*finally:*/ {
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27);
      if ( unlikely(__Pyx_GetException(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
      __Pyx_XGOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_23);
      __Pyx_XGOTREF(__pyx_t_24);
      __Pyx_XGOTREF(__pyx_t_25);
      __Pyx_XGOTREF(__pyx_t_26);
      __Pyx_XGOTREF(__pyx_t_27);
      __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
      {
        XRRFreeScreenConfigInfo(__pyx_v_config);
      }
      __Pyx_XGIVEREF(__pyx_t_25);
      __Pyx_XGIVEREF(__pyx_t_26);
      __Pyx_XGIVEREF(__pyx_t_27);
      __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_26, __pyx_t_27);
      __Pyx_XGIVEREF(__pyx_t_22);
      __Pyx_XGIVEREF(__pyx_t_23);
      __Pyx_XGIVEREF(__pyx_t_24);
      __Pyx_ErrRestore(__pyx_t_22, __pyx_t_23, __pyx_t_24);
      __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
      __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_21;
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_11 = __pyx_r;
      XRRFreeScreenConfigInfo(__pyx_v_config);
      __pyx_r = __pyx_t_11;
      goto __pyx_L0;
    }
  }

  /* "xpra/x11/bindings/randr.pyx":664
 *         return v
 * 
 *     cdef int _set_screen_size(self, width, height):             # <<<<<<<<<<<<<<
 *         self.context_check("set-screen-size")
 *         cdef int num_sizes = 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance._set_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XDECREF(__pyx_v_oversize);
  __Pyx_XDECREF(__pyx_v_extra);
  __Pyx_XDECREF(__pyx_gb_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16_set_screen_size_2generator8);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":734
 *             XRRFreeScreenConfigInfo(config)
 * 
 *     def get_screen_count(self) -> int:             # <<<<<<<<<<<<<<
 *         return XScreenCount(self.display)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_17get_screen_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_17get_screen_count = {"get_screen_count", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_17get_screen_count, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_17get_screen_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_screen_count (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16get_screen_count(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_16get_screen_count(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_screen_count", 0);

  /* "xpra/x11/bindings/randr.pyx":735
 * 
 *     def get_screen_count(self) -> int:
 *         return XScreenCount(self.display)             # <<<<<<<<<<<<<<
 * 
 *     def get_screen_size_mm(self) -> Tuple[int, int]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(XScreenCount(__pyx_v_self->__pyx_base.display)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 735, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":734
 *             XRRFreeScreenConfigInfo(config)
 * 
 *     def get_screen_count(self) -> int:             # <<<<<<<<<<<<<<
 *         return XScreenCount(self.display)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_screen_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":737
 *         return XScreenCount(self.display)
 * 
 *     def get_screen_size_mm(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         sizes = self.get_screen_sizes_mm()
 *         tw, th = 0, 0
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_19get_screen_size_mm(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_19get_screen_size_mm = {"get_screen_size_mm", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_19get_screen_size_mm, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_19get_screen_size_mm(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_screen_size_mm (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_18get_screen_size_mm(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_18get_screen_size_mm(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_v_sizes = NULL;
  PyObject *__pyx_v_tw = NULL;
  PyObject *__pyx_v_th = NULL;
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_screen_size_mm", 0);

  /* "xpra/x11/bindings/randr.pyx":738
 * 
 *     def get_screen_size_mm(self) -> Tuple[int, int]:
 *         sizes = self.get_screen_sizes_mm()             # <<<<<<<<<<<<<<
 *         tw, th = 0, 0
 *         log("screen sizes for all screens in mm: %s", sizes)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_screen_sizes_mm, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_sizes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":739
 *     def get_screen_size_mm(self) -> Tuple[int, int]:
 *         sizes = self.get_screen_sizes_mm()
 *         tw, th = 0, 0             # <<<<<<<<<<<<<<
 *         log("screen sizes for all screens in mm: %s", sizes)
 *         for w, h in sizes:
*/
  __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_tw = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_th = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":740
 *         sizes = self.get_screen_sizes_mm()
 *         tw, th = 0, 0
 *         log("screen sizes for all screens in mm: %s", sizes)             # <<<<<<<<<<<<<<
 *         for w, h in sizes:
 *             tw += w
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_screen_sizes_for_all_screens_in, __pyx_v_sizes};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":741
 *         tw, th = 0, 0
 *         log("screen sizes for all screens in mm: %s", sizes)
 *         for w, h in sizes:             # <<<<<<<<<<<<<<
 *             tw += w
 *             th += h
*/
  if (likely(PyList_CheckExact(__pyx_v_sizes)) || PyTuple_CheckExact(__pyx_v_sizes)) {
    __pyx_t_2 = __pyx_v_sizes; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_sizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 741, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 741, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_5;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 741, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5);
        #endif
        ++__pyx_t_5;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 741, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 741, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 741, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 741, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
      }
      #else
      __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 741, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 741, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
      index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 741, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 741, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "xpra/x11/bindings/randr.pyx":742
 *         log("screen sizes for all screens in mm: %s", sizes)
 *         for w, h in sizes:
 *             tw += w             # <<<<<<<<<<<<<<
 *             th += h
 *         return tw, th
*/
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tw, __pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_tw, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":743
 *         for w, h in sizes:
 *             tw += w
 *             th += h             # <<<<<<<<<<<<<<
 *         return tw, th
 * 
*/
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_th, __pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_th, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":741
 *         tw, th = 0, 0
 *         log("screen sizes for all screens in mm: %s", sizes)
 *         for w, h in sizes:             # <<<<<<<<<<<<<<
 *             tw += w
 *             th += h
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":744
 *             tw += w
 *             th += h
 *         return tw, th             # <<<<<<<<<<<<<<
 * 
 *     def get_screen_sizes_mm(self) -> List[Tuple[int, int]]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_tw);
  __Pyx_GIVEREF(__pyx_v_tw);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tw) != (0)) __PYX_ERR(0, 744, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_th);
  __Pyx_GIVEREF(__pyx_v_th);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_th) != (0)) __PYX_ERR(0, 744, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":737
 *         return XScreenCount(self.display)
 * 
 *     def get_screen_size_mm(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         sizes = self.get_screen_sizes_mm()
 *         tw, th = 0, 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_screen_size_mm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XDECREF(__pyx_v_tw);
  __Pyx_XDECREF(__pyx_v_th);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":746
 *         return tw, th
 * 
 *     def get_screen_sizes_mm(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_21get_screen_sizes_mm(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_21get_screen_sizes_mm = {"get_screen_sizes_mm", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_21get_screen_sizes_mm, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_21get_screen_sizes_mm(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_screen_sizes_mm (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_20get_screen_sizes_mm(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_20get_screen_sizes_mm(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  unsigned int __pyx_v_n;
  unsigned int __pyx_v_i;
  unsigned int __pyx_v_w;
  unsigned int __pyx_v_h;
  PyObject *__pyx_v_sizes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_screen_sizes_mm", 0);

  /* "xpra/x11/bindings/randr.pyx":747
 * 
 *     def get_screen_sizes_mm(self) -> List[Tuple[int, int]]:
 *         cdef unsigned int n = XScreenCount(self.display)             # <<<<<<<<<<<<<<
 *         cdef unsigned int i, w, h
 *         cdef object sizes = []
*/
  __pyx_v_n = XScreenCount(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":749
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
 *         cdef object sizes = []             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             w = XDisplayWidthMM(self.display, i)
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sizes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":750
 *         cdef unsigned int i, w, h
 *         cdef object sizes = []
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             w = XDisplayWidthMM(self.display, i)
 *             h = XDisplayHeightMM(self.display, i)
*/
  __pyx_t_2 = __pyx_v_n;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "xpra/x11/bindings/randr.pyx":751
 *         cdef object sizes = []
 *         for i in range(n):
 *             w = XDisplayWidthMM(self.display, i)             # <<<<<<<<<<<<<<
 *             h = XDisplayHeightMM(self.display, i)
 *             sizes.append((w, h))
*/
    __pyx_v_w = XDisplayWidthMM(__pyx_v_self->__pyx_base.display, __pyx_v_i);

    /* "xpra/x11/bindings/randr.pyx":752
 *         for i in range(n):
 *             w = XDisplayWidthMM(self.display, i)
 *             h = XDisplayHeightMM(self.display, i)             # <<<<<<<<<<<<<<
 *             sizes.append((w, h))
 *         return sizes
*/
    __pyx_v_h = XDisplayHeightMM(__pyx_v_self->__pyx_base.display, __pyx_v_i);

    /* "xpra/x11/bindings/randr.pyx":753
 *             w = XDisplayWidthMM(self.display, i)
 *             h = XDisplayHeightMM(self.display, i)
 *             sizes.append((w, h))             # <<<<<<<<<<<<<<
 *         return sizes
 * 
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 753, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 753, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_sizes, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }

  /* "xpra/x11/bindings/randr.pyx":754
 *             h = XDisplayHeightMM(self.display, i)
 *             sizes.append((w, h))
 *         return sizes             # <<<<<<<<<<<<<<
 * 
 *     def get_screen_sizes(self) -> List[Tuple[int, int]]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_v_sizes;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyList_CheckExact(__pyx_t_6)) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_6))) __PYX_ERR(0, 754, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":746
 *         return tw, th
 * 
 *     def get_screen_sizes_mm(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_screen_sizes_mm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":756
 *         return sizes
 * 
 *     def get_screen_sizes(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_23get_screen_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_23get_screen_sizes = {"get_screen_sizes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_23get_screen_sizes, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_23get_screen_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_screen_sizes (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_22get_screen_sizes(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_22get_screen_sizes(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  unsigned int __pyx_v_n;
  unsigned int __pyx_v_i;
  unsigned int __pyx_v_w;
  unsigned int __pyx_v_h;
  PyObject *__pyx_v_sizes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_screen_sizes", 0);

  /* "xpra/x11/bindings/randr.pyx":757
 * 
 *     def get_screen_sizes(self) -> List[Tuple[int, int]]:
 *         cdef unsigned int n = XScreenCount(self.display)             # <<<<<<<<<<<<<<
 *         cdef unsigned int i, w, h
 *         cdef object sizes = []
*/
  __pyx_v_n = XScreenCount(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":759
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
 *         cdef object sizes = []             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             w = XDisplayWidth(self.display, i)
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sizes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":760
 *         cdef unsigned int i, w, h
 *         cdef object sizes = []
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             w = XDisplayWidth(self.display, i)
 *             h = XDisplayHeight(self.display, i)
*/
  __pyx_t_2 = __pyx_v_n;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "xpra/x11/bindings/randr.pyx":761
 *         cdef object sizes = []
 *         for i in range(n):
 *             w = XDisplayWidth(self.display, i)             # <<<<<<<<<<<<<<
 *             h = XDisplayHeight(self.display, i)
 *             sizes.append((w, h))
*/
    __pyx_v_w = XDisplayWidth(__pyx_v_self->__pyx_base.display, __pyx_v_i);

    /* "xpra/x11/bindings/randr.pyx":762
 *         for i in range(n):
 *             w = XDisplayWidth(self.display, i)
 *             h = XDisplayHeight(self.display, i)             # <<<<<<<<<<<<<<
 *             sizes.append((w, h))
 *         return sizes
*/
    __pyx_v_h = XDisplayHeight(__pyx_v_self->__pyx_base.display, __pyx_v_i);

    /* "xpra/x11/bindings/randr.pyx":763
 *             w = XDisplayWidth(self.display, i)
 *             h = XDisplayHeight(self.display, i)
 *             sizes.append((w, h))             # <<<<<<<<<<<<<<
 *         return sizes
 * 
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 763, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 763, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_sizes, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }

  /* "xpra/x11/bindings/randr.pyx":764
 *             h = XDisplayHeight(self.display, i)
 *             sizes.append((w, h))
 *         return sizes             # <<<<<<<<<<<<<<
 * 
 *     def get_screen_size(self) -> Tuple[int, int]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_v_sizes;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyList_CheckExact(__pyx_t_6)) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_6))) __PYX_ERR(0, 764, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":756
 *         return sizes
 * 
 *     def get_screen_sizes(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_screen_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":766
 *         return sizes
 * 
 *     def get_screen_size(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRCrtcInfo *crtc_info = NULL
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_25get_screen_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_25get_screen_size = {"get_screen_size", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_25get_screen_size, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_25get_screen_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_screen_size (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_24get_screen_size(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_24get_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRCrtcInfo *__pyx_v_crtc_info;
  XRRScreenResources *__pyx_v_rsc;
  long __pyx_v_maxx;
  long __pyx_v_maxy;
  int __pyx_v_crtc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  unsigned int __pyx_t_11;
  long __pyx_t_12;
  long __pyx_t_13;
  char const *__pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_screen_size", 0);

  /* "xpra/x11/bindings/randr.pyx":767
 * 
 *     def get_screen_size(self) -> Tuple[int, int]:
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":768
 *     def get_screen_size(self) -> Tuple[int, int]:
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRCrtcInfo *crtc_info = NULL             # <<<<<<<<<<<<<<
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if not rsc:
*/
  __pyx_v_crtc_info = NULL;

  /* "xpra/x11/bindings/randr.pyx":769
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)             # <<<<<<<<<<<<<<
 *         if not rsc:
 *             raise RuntimeError("cannot access screen resources")
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":770
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if not rsc:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("cannot access screen resources")
 *         maxx = maxy = 0
*/
  __pyx_t_1 = (!(__pyx_v_rsc != 0));
  if (unlikely(__pyx_t_1)) {

    /* "xpra/x11/bindings/randr.pyx":771
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if not rsc:
 *             raise RuntimeError("cannot access screen resources")             # <<<<<<<<<<<<<<
 *         maxx = maxy = 0
 *         try:
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_cannot_access_screen_resources};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 771, __pyx_L1_error)

    /* "xpra/x11/bindings/randr.pyx":770
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if not rsc:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("cannot access screen resources")
 *         maxx = maxy = 0
*/
  }

  /* "xpra/x11/bindings/randr.pyx":772
 *         if not rsc:
 *             raise RuntimeError("cannot access screen resources")
 *         maxx = maxy = 0             # <<<<<<<<<<<<<<
 *         try:
 *             for crtc in range(rsc.ncrtc):
*/
  __pyx_v_maxx = 0;
  __pyx_v_maxy = 0;

  /* "xpra/x11/bindings/randr.pyx":773
 *             raise RuntimeError("cannot access screen resources")
 *         maxx = maxy = 0
 *         try:             # <<<<<<<<<<<<<<
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":774
 *         maxx = maxy = 0
 *         try:
 *             for crtc in range(rsc.ncrtc):             # <<<<<<<<<<<<<<
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:
*/
    __pyx_t_5 = __pyx_v_rsc->ncrtc;
    __pyx_t_6 = __pyx_t_5;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_crtc = __pyx_t_7;

      /* "xpra/x11/bindings/randr.pyx":775
 *         try:
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])             # <<<<<<<<<<<<<<
 *                 if crtc_info==NULL:
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
*/
      __pyx_v_crtc_info = XRRGetCrtcInfo(__pyx_v_self->__pyx_base.display, __pyx_v_rsc, (__pyx_v_rsc->crtcs[__pyx_v_crtc]));

      /* "xpra/x11/bindings/randr.pyx":776
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:             # <<<<<<<<<<<<<<
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue
*/
      __pyx_t_1 = (__pyx_v_crtc_info == NULL);
      if (__pyx_t_1) {

        /* "xpra/x11/bindings/randr.pyx":777
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:
 *                     log.warn(f"Warning: no CRTC info for {crtc}")             # <<<<<<<<<<<<<<
 *                     continue
 *                 if crtc_info.noutput == 0:
*/
        __pyx_t_3 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 777, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 777, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_crtc, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 777, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Warning_no_CRTC_info_for, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 777, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_10};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "xpra/x11/bindings/randr.pyx":778
 *                 if crtc_info==NULL:
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue             # <<<<<<<<<<<<<<
 *                 if crtc_info.noutput == 0:
 *                     continue
*/
        goto __pyx_L7_continue;

        /* "xpra/x11/bindings/randr.pyx":776
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:             # <<<<<<<<<<<<<<
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue
*/
      }

      /* "xpra/x11/bindings/randr.pyx":779
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue
 *                 if crtc_info.noutput == 0:             # <<<<<<<<<<<<<<
 *                     continue
 *                 try:
*/
      __pyx_t_1 = (__pyx_v_crtc_info->noutput == 0);
      if (__pyx_t_1) {

        /* "xpra/x11/bindings/randr.pyx":780
 *                     continue
 *                 if crtc_info.noutput == 0:
 *                     continue             # <<<<<<<<<<<<<<
 *                 try:
 *                     maxx = max(maxx, crtc_info.x + crtc_info.width)
*/
        goto __pyx_L7_continue;

        /* "xpra/x11/bindings/randr.pyx":779
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue
 *                 if crtc_info.noutput == 0:             # <<<<<<<<<<<<<<
 *                     continue
 *                 try:
*/
      }

      /* "xpra/x11/bindings/randr.pyx":781
 *                 if crtc_info.noutput == 0:
 *                     continue
 *                 try:             # <<<<<<<<<<<<<<
 *                     maxx = max(maxx, crtc_info.x + crtc_info.width)
 *                     maxy = max(maxy, crtc_info.y + crtc_info.height)
*/
      /*try:*/ {

        /* "xpra/x11/bindings/randr.pyx":782
 *                     continue
 *                 try:
 *                     maxx = max(maxx, crtc_info.x + crtc_info.width)             # <<<<<<<<<<<<<<
 *                     maxy = max(maxy, crtc_info.y + crtc_info.height)
 *                 finally:
*/
        __pyx_t_11 = (__pyx_v_crtc_info->x + __pyx_v_crtc_info->width);
        __pyx_t_12 = __pyx_v_maxx;
        __pyx_t_1 = (__pyx_t_11 > __pyx_t_12);
        if (__pyx_t_1) {
          __pyx_t_13 = __pyx_t_11;
        } else {
          __pyx_t_13 = __pyx_t_12;
        }
        __pyx_v_maxx = __pyx_t_13;

        /* "xpra/x11/bindings/randr.pyx":783
 *                 try:
 *                     maxx = max(maxx, crtc_info.x + crtc_info.width)
 *                     maxy = max(maxy, crtc_info.y + crtc_info.height)             # <<<<<<<<<<<<<<
 *                 finally:
 *                     XRRFreeCrtcInfo(crtc_info)
*/
        __pyx_t_11 = (__pyx_v_crtc_info->y + __pyx_v_crtc_info->height);
        __pyx_t_13 = __pyx_v_maxy;
        __pyx_t_1 = (__pyx_t_11 > __pyx_t_13);
        if (__pyx_t_1) {
          __pyx_t_12 = __pyx_t_11;
        } else {
          __pyx_t_12 = __pyx_t_13;
        }
        __pyx_v_maxy = __pyx_t_12;
      }

      /* "xpra/x11/bindings/randr.pyx":785
 *                     maxy = max(maxy, crtc_info.y + crtc_info.height)
 *                 finally:
 *                     XRRFreeCrtcInfo(crtc_info)             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenResources(rsc)
*/
      /*finally:*/ {
        /*normal exit:*/{
          XRRFreeCrtcInfo(__pyx_v_crtc_info);
          goto __pyx_L15;
        }
        __pyx_L15:;
      }
      __pyx_L7_continue:;
    }
  }

  /* "xpra/x11/bindings/randr.pyx":787
 *                     XRRFreeCrtcInfo(crtc_info)
 *         finally:
 *             XRRFreeScreenResources(rsc)             # <<<<<<<<<<<<<<
 *         return maxx, maxy
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      XRRFreeScreenResources(__pyx_v_rsc);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
      if ( unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_20);
      __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
      {
        XRRFreeScreenResources(__pyx_v_rsc);
      }
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_14;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "xpra/x11/bindings/randr.pyx":788
 *         finally:
 *             XRRFreeScreenResources(rsc)
 *         return maxx, maxy             # <<<<<<<<<<<<<<
 * 
 *     def get_screen_size_range(self) -> Tuple[Tuple[int, int], Tuple[int, int]]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyLong_From_long(__pyx_v_maxx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyLong_From_long(__pyx_v_maxy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 788, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 788, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_9 = 0;
  __pyx_r = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":766
 *         return sizes
 * 
 *     def get_screen_size(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRCrtcInfo *crtc_info = NULL
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":790
 *         return maxx, maxy
 * 
 *     def get_screen_size_range(self) -> Tuple[Tuple[int, int], Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef int minWidth, minHeight, maxWidth, maxHeight
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_27get_screen_size_range(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_27get_screen_size_range = {"get_screen_size_range", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_27get_screen_size_range, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_27get_screen_size_range(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_screen_size_range (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_26get_screen_size_range(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_26get_screen_size_range(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  int __pyx_v_minWidth;
  int __pyx_v_minHeight;
  int __pyx_v_maxWidth;
  int __pyx_v_maxHeight;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Status __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_screen_size_range", 0);

  /* "xpra/x11/bindings/randr.pyx":791
 * 
 *     def get_screen_size_range(self) -> Tuple[Tuple[int, int], Tuple[int, int]]:
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef int minWidth, minHeight, maxWidth, maxHeight
 *         cdef Status status = XRRGetScreenSizeRange(self.display, window, &minWidth, &minHeight, &maxWidth, &maxHeight)
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":793
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef int minWidth, minHeight, maxWidth, maxHeight
 *         cdef Status status = XRRGetScreenSizeRange(self.display, window, &minWidth, &minHeight, &maxWidth, &maxHeight)             # <<<<<<<<<<<<<<
 *         if status <= 0:
 *             raise RuntimeError("unable to query screen size range")
*/
  __pyx_v_status = XRRGetScreenSizeRange(__pyx_v_self->__pyx_base.display, __pyx_v_window, (&__pyx_v_minWidth), (&__pyx_v_minHeight), (&__pyx_v_maxWidth), (&__pyx_v_maxHeight));

  /* "xpra/x11/bindings/randr.pyx":794
 *         cdef int minWidth, minHeight, maxWidth, maxHeight
 *         cdef Status status = XRRGetScreenSizeRange(self.display, window, &minWidth, &minHeight, &maxWidth, &maxHeight)
 *         if status <= 0:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("unable to query screen size range")
 *         return (minWidth, minHeight), (maxWidth, maxHeight)
*/
  __pyx_t_1 = (__pyx_v_status <= 0);
  if (unlikely(__pyx_t_1)) {

    /* "xpra/x11/bindings/randr.pyx":795
 *         cdef Status status = XRRGetScreenSizeRange(self.display, window, &minWidth, &minHeight, &maxWidth, &maxHeight)
 *         if status <= 0:
 *             raise RuntimeError("unable to query screen size range")             # <<<<<<<<<<<<<<
 *         return (minWidth, minHeight), (maxWidth, maxHeight)
 * 
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_unable_to_query_screen_size_rang};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 795, __pyx_L1_error)

    /* "xpra/x11/bindings/randr.pyx":794
 *         cdef int minWidth, minHeight, maxWidth, maxHeight
 *         cdef Status status = XRRGetScreenSizeRange(self.display, window, &minWidth, &minHeight, &maxWidth, &maxHeight)
 *         if status <= 0:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("unable to query screen size range")
 *         return (minWidth, minHeight), (maxWidth, maxHeight)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":796
 *         if status <= 0:
 *             raise RuntimeError("unable to query screen size range")
 *         return (minWidth, minHeight), (maxWidth, maxHeight)             # <<<<<<<<<<<<<<
 * 
 *     def get_vrefresh(self) -> int:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_minWidth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_minHeight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 796, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 796, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_maxWidth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_maxHeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 796, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 796, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 796, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 796, __pyx_L1_error);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":790
 *         return maxx, maxy
 * 
 *     def get_screen_size_range(self) -> Tuple[Tuple[int, int], Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef int minWidth, minHeight, maxWidth, maxHeight
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_screen_size_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":798
 *         return (minWidth, minHeight), (maxWidth, maxHeight)
 * 
 *     def get_vrefresh(self) -> int:             # <<<<<<<<<<<<<<
 *         voutputs = self.get_vrefresh_outputs()
 *         if voutputs:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_29get_vrefresh(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_29get_vrefresh = {"get_vrefresh", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_29get_vrefresh, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_29get_vrefresh(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_vrefresh (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_28get_vrefresh(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_28get_vrefresh(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_v_voutputs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_vrefresh", 0);

  /* "xpra/x11/bindings/randr.pyx":799
 * 
 *     def get_vrefresh(self) -> int:
 *         voutputs = self.get_vrefresh_outputs()             # <<<<<<<<<<<<<<
 *         if voutputs:
 *             return min(voutputs.values())
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_vrefresh_outputs, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_voutputs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":800
 *     def get_vrefresh(self) -> int:
 *         voutputs = self.get_vrefresh_outputs()
 *         if voutputs:             # <<<<<<<<<<<<<<
 *             return min(voutputs.values())
 *         return self.get_vrefresh_display()
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_voutputs); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 800, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "xpra/x11/bindings/randr.pyx":801
 *         voutputs = self.get_vrefresh_outputs()
 *         if voutputs:
 *             return min(voutputs.values())             # <<<<<<<<<<<<<<
 *         return self.get_vrefresh_display()
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __pyx_t_6 = __pyx_v_voutputs;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 801, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":800
 *     def get_vrefresh(self) -> int:
 *         voutputs = self.get_vrefresh_outputs()
 *         if voutputs:             # <<<<<<<<<<<<<<
 *             return min(voutputs.values())
 *         return self.get_vrefresh_display()
*/
  }

  /* "xpra/x11/bindings/randr.pyx":802
 *         if voutputs:
 *             return min(voutputs.values())
 *         return self.get_vrefresh_display()             # <<<<<<<<<<<<<<
 * 
 *     def get_vrefresh_display(self) -> int:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_vrefresh_display, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 802, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":798
 *         return (minWidth, minHeight), (maxWidth, maxHeight)
 * 
 *     def get_vrefresh(self) -> int:             # <<<<<<<<<<<<<<
 *         voutputs = self.get_vrefresh_outputs()
 *         if voutputs:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_vrefresh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_voutputs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":804
 *         return self.get_vrefresh_display()
 * 
 *     def get_vrefresh_display(self) -> int:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_31get_vrefresh_display(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_31get_vrefresh_display = {"get_vrefresh_display", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_31get_vrefresh_display, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_31get_vrefresh_display(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_vrefresh_display (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_30get_vrefresh_display(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_30get_vrefresh_display(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenConfiguration *__pyx_v_config;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_vrefresh_display", 0);

  /* "xpra/x11/bindings/randr.pyx":805
 * 
 *     def get_vrefresh_display(self) -> int:
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":806
 *     def get_vrefresh_display(self) -> int:
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)             # <<<<<<<<<<<<<<
 *         if config==NULL:
 *             log.error("Error: cannot get refresh rate from screen info")
*/
  __pyx_v_config = XRRGetScreenInfo(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":807
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot get refresh rate from screen info")
 *             return 0
*/
  __pyx_t_1 = (__pyx_v_config == NULL);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":808
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:
 *             log.error("Error: cannot get refresh rate from screen info")             # <<<<<<<<<<<<<<
 *             return 0
 *         try:
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Error_cannot_get_refresh_rate_fr};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":809
 *         if config==NULL:
 *             log.error("Error: cannot get refresh rate from screen info")
 *             return 0             # <<<<<<<<<<<<<<
 *         try:
 *             return XRRConfigCurrentRate(config)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_r = __pyx_mstate_global->__pyx_int_0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":807
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
 *         if config==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot get refresh rate from screen info")
 *             return 0
*/
  }

  /* "xpra/x11/bindings/randr.pyx":810
 *             log.error("Error: cannot get refresh rate from screen info")
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             return XRRConfigCurrentRate(config)
 *         finally:
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":811
 *             return 0
 *         try:
 *             return XRRConfigCurrentRate(config)             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenConfigInfo(config)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyLong_From_short(XRRConfigCurrentRate(__pyx_v_config)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 811, __pyx_L5_error)
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L4_return;
  }

  /* "xpra/x11/bindings/randr.pyx":813
 *             return XRRConfigCurrentRate(config)
 *         finally:
 *             XRRFreeScreenConfigInfo(config)             # <<<<<<<<<<<<<<
 * 
 *     def get_vrefresh_outputs(self) -> Dict[int, int]:
*/
  /*finally:*/ {
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ( unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        XRRFreeScreenConfigInfo(__pyx_v_config);
      }
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_16 = __pyx_r;
      __pyx_r = 0;
      XRRFreeScreenConfigInfo(__pyx_v_config);
      __pyx_r = __pyx_t_16;
      __pyx_t_16 = 0;
      goto __pyx_L0;
    }
  }

  /* "xpra/x11/bindings/randr.pyx":804
 *         return self.get_vrefresh_display()
 * 
 *     def get_vrefresh_display(self) -> int:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_vrefresh_display", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":815
 *             XRRFreeScreenConfigInfo(config)
 * 
 *     def get_vrefresh_outputs(self) -> Dict[int, int]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRROutputInfo *output_info = NULL
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_33get_vrefresh_outputs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_33get_vrefresh_outputs = {"get_vrefresh_outputs", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_33get_vrefresh_outputs, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_33get_vrefresh_outputs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_vrefresh_outputs (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_32get_vrefresh_outputs(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_32get_vrefresh_outputs(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRROutputInfo *__pyx_v_output_info;
  XRRCrtcInfo *__pyx_v_crtc_info;
  XRRModeInfo *__pyx_v_mode_info;
  PyObject *__pyx_v_rates = NULL;
  XRRScreenResources *__pyx_v_rsc;
  int __pyx_v_crtc;
  int __pyx_v_i;
  PyObject *__pyx_v_rate = NULL;
  PyObject *__pyx_v_output_names = NULL;
  int __pyx_v_o;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  PyObject *__pyx_t_19[4];
  PyObject *__pyx_t_20 = NULL;
  char const *__pyx_t_21;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  char const *__pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_vrefresh_outputs", 0);

  /* "xpra/x11/bindings/randr.pyx":816
 * 
 *     def get_vrefresh_outputs(self) -> Dict[int, int]:
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRROutputInfo *output_info = NULL
 *         cdef XRRCrtcInfo *crtc_info = NULL
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":817
 *     def get_vrefresh_outputs(self) -> Dict[int, int]:
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRROutputInfo *output_info = NULL             # <<<<<<<<<<<<<<
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef XRRModeInfo *mode_info = NULL
*/
  __pyx_v_output_info = NULL;

  /* "xpra/x11/bindings/randr.pyx":818
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRROutputInfo *output_info = NULL
 *         cdef XRRCrtcInfo *crtc_info = NULL             # <<<<<<<<<<<<<<
 *         cdef XRRModeInfo *mode_info = NULL
 *         rates = {}
*/
  __pyx_v_crtc_info = NULL;

  /* "xpra/x11/bindings/randr.pyx":819
 *         cdef XRROutputInfo *output_info = NULL
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef XRRModeInfo *mode_info = NULL             # <<<<<<<<<<<<<<
 *         rates = {}
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
*/
  __pyx_v_mode_info = NULL;

  /* "xpra/x11/bindings/randr.pyx":820
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef XRRModeInfo *mode_info = NULL
 *         rates = {}             # <<<<<<<<<<<<<<
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rates = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":821
 *         cdef XRRModeInfo *mode_info = NULL
 *         rates = {}
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)             # <<<<<<<<<<<<<<
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":822
 *         rates = {}
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot access screen resources")
 *             return 0
*/
  __pyx_t_2 = (__pyx_v_rsc == NULL);
  if (__pyx_t_2) {

    /* "xpra/x11/bindings/randr.pyx":823
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")             # <<<<<<<<<<<<<<
 *             return 0
 *         try:
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Error_cannot_access_screen_resou};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":824
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")
 *             return 0             # <<<<<<<<<<<<<<
 *         try:
 *             for crtc in range(rsc.ncrtc):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(PyDict_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(0, 824, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":822
 *         rates = {}
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot access screen resources")
 *             return 0
*/
  }

  /* "xpra/x11/bindings/randr.pyx":825
 *             log.error("Error: cannot access screen resources")
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":826
 *             return 0
 *         try:
 *             for crtc in range(rsc.ncrtc):             # <<<<<<<<<<<<<<
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:
*/
    __pyx_t_7 = __pyx_v_rsc->ncrtc;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_crtc = __pyx_t_9;

      /* "xpra/x11/bindings/randr.pyx":827
 *         try:
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])             # <<<<<<<<<<<<<<
 *                 if crtc_info==NULL:
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
*/
      __pyx_v_crtc_info = XRRGetCrtcInfo(__pyx_v_self->__pyx_base.display, __pyx_v_rsc, (__pyx_v_rsc->crtcs[__pyx_v_crtc]));

      /* "xpra/x11/bindings/randr.pyx":828
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:             # <<<<<<<<<<<<<<
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue
*/
      __pyx_t_2 = (__pyx_v_crtc_info == NULL);
      if (__pyx_t_2) {

        /* "xpra/x11/bindings/randr.pyx":829
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:
 *                     log.warn(f"Warning: no CRTC info for {crtc}")             # <<<<<<<<<<<<<<
 *                     continue
 *                 try:
*/
        __pyx_t_5 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 829, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_crtc, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 829, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Warning_no_CRTC_info_for, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 829, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":830
 *                 if crtc_info==NULL:
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue             # <<<<<<<<<<<<<<
 *                 try:
 *                     #find the mode info:
*/
        goto __pyx_L7_continue;

        /* "xpra/x11/bindings/randr.pyx":828
 *             for crtc in range(rsc.ncrtc):
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, rsc.crtcs[crtc])
 *                 if crtc_info==NULL:             # <<<<<<<<<<<<<<
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue
*/
      }

      /* "xpra/x11/bindings/randr.pyx":831
 *                     log.warn(f"Warning: no CRTC info for {crtc}")
 *                     continue
 *                 try:             # <<<<<<<<<<<<<<
 *                     #find the mode info:
 *                     for i in range(rsc.nmode):
*/
      /*try:*/ {

        /* "xpra/x11/bindings/randr.pyx":833
 *                 try:
 *                     #find the mode info:
 *                     for i in range(rsc.nmode):             # <<<<<<<<<<<<<<
 *                         mode_info = &rsc.modes[i]
 *                         if mode_info.id==crtc_info.mode:
*/
        __pyx_t_11 = __pyx_v_rsc->nmode;
        __pyx_t_12 = __pyx_t_11;
        for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
          __pyx_v_i = __pyx_t_13;

          /* "xpra/x11/bindings/randr.pyx":834
 *                     #find the mode info:
 *                     for i in range(rsc.nmode):
 *                         mode_info = &rsc.modes[i]             # <<<<<<<<<<<<<<
 *                         if mode_info.id==crtc_info.mode:
 *                             if mode_info.hTotal and mode_info.vTotal:
*/
          __pyx_v_mode_info = (&(__pyx_v_rsc->modes[__pyx_v_i]));

          /* "xpra/x11/bindings/randr.pyx":835
 *                     for i in range(rsc.nmode):
 *                         mode_info = &rsc.modes[i]
 *                         if mode_info.id==crtc_info.mode:             # <<<<<<<<<<<<<<
 *                             if mode_info.hTotal and mode_info.vTotal:
 *                                 rate = round(mode_info.dotClock / (mode_info.hTotal * mode_info.vTotal))
*/
          __pyx_t_2 = (__pyx_v_mode_info->id == __pyx_v_crtc_info->mode);
          if (__pyx_t_2) {

            /* "xpra/x11/bindings/randr.pyx":836
 *                         mode_info = &rsc.modes[i]
 *                         if mode_info.id==crtc_info.mode:
 *                             if mode_info.hTotal and mode_info.vTotal:             # <<<<<<<<<<<<<<
 *                                 rate = round(mode_info.dotClock / (mode_info.hTotal * mode_info.vTotal))
 *                                 #outputs affected:
*/
            __pyx_t_14 = (__pyx_v_mode_info->hTotal != 0);
            if (__pyx_t_14) {
            } else {
              __pyx_t_2 = __pyx_t_14;
              goto __pyx_L19_bool_binop_done;
            }
            __pyx_t_14 = (__pyx_v_mode_info->vTotal != 0);
            __pyx_t_2 = __pyx_t_14;
            __pyx_L19_bool_binop_done:;
            if (__pyx_t_2) {

              /* "xpra/x11/bindings/randr.pyx":837
 *                         if mode_info.id==crtc_info.mode:
 *                             if mode_info.hTotal and mode_info.vTotal:
 *                                 rate = round(mode_info.dotClock / (mode_info.hTotal * mode_info.vTotal))             # <<<<<<<<<<<<<<
 *                                 #outputs affected:
 *                                 output_names = []
*/
              __pyx_t_4 = NULL;
              __pyx_t_10 = __Pyx_PyLong_From_unsigned_long((__pyx_v_mode_info->dotClock / ((unsigned long)(__pyx_v_mode_info->hTotal * __pyx_v_mode_info->vTotal)))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 837, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_6 = 1;
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_10};
                __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L13_error)
                __Pyx_GOTREF(__pyx_t_1);
              }
              __Pyx_XDECREF_SET(__pyx_v_rate, __pyx_t_1);
              __pyx_t_1 = 0;

              /* "xpra/x11/bindings/randr.pyx":839
 *                                 rate = round(mode_info.dotClock / (mode_info.hTotal * mode_info.vTotal))
 *                                 #outputs affected:
 *                                 output_names = []             # <<<<<<<<<<<<<<
 *                                 for o in range(crtc_info.noutput):
 *                                     output_info = XRRGetOutputInfo(self.display, rsc, crtc_info.outputs[o])
*/
              __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_XDECREF_SET(__pyx_v_output_names, ((PyObject*)__pyx_t_1));
              __pyx_t_1 = 0;

              /* "xpra/x11/bindings/randr.pyx":840
 *                                 #outputs affected:
 *                                 output_names = []
 *                                 for o in range(crtc_info.noutput):             # <<<<<<<<<<<<<<
 *                                     output_info = XRRGetOutputInfo(self.display, rsc, crtc_info.outputs[o])
 *                                     if output_info!=NULL:
*/
              __pyx_t_15 = __pyx_v_crtc_info->noutput;
              __pyx_t_16 = __pyx_t_15;
              for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
                __pyx_v_o = __pyx_t_17;

                /* "xpra/x11/bindings/randr.pyx":841
 *                                 output_names = []
 *                                 for o in range(crtc_info.noutput):
 *                                     output_info = XRRGetOutputInfo(self.display, rsc, crtc_info.outputs[o])             # <<<<<<<<<<<<<<
 *                                     if output_info!=NULL:
 *                                         output_names.append(decode_str(output_info.name))
*/
                __pyx_v_output_info = XRRGetOutputInfo(__pyx_v_self->__pyx_base.display, __pyx_v_rsc, (__pyx_v_crtc_info->outputs[__pyx_v_o]));

                /* "xpra/x11/bindings/randr.pyx":842
 *                                 for o in range(crtc_info.noutput):
 *                                     output_info = XRRGetOutputInfo(self.display, rsc, crtc_info.outputs[o])
 *                                     if output_info!=NULL:             # <<<<<<<<<<<<<<
 *                                         output_names.append(decode_str(output_info.name))
 *                                         XRRFreeOutputInfo(output_info)
*/
                __pyx_t_2 = (__pyx_v_output_info != NULL);
                if (__pyx_t_2) {

                  /* "xpra/x11/bindings/randr.pyx":843
 *                                     output_info = XRRGetOutputInfo(self.display, rsc, crtc_info.outputs[o])
 *                                     if output_info!=NULL:
 *                                         output_names.append(decode_str(output_info.name))             # <<<<<<<<<<<<<<
 *                                         XRRFreeOutputInfo(output_info)
 *                                 log(f"refresh rate for {csv(output_names)} : {rate}")
*/
                  __pyx_t_10 = NULL;
                  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_decode_str); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L13_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_output_info->name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L13_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  __pyx_t_6 = 1;
                  #if CYTHON_UNPACK_METHODS
                  if (unlikely(PyMethod_Check(__pyx_t_4))) {
                    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
                    assert(__pyx_t_10);
                    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
                    __Pyx_INCREF(__pyx_t_10);
                    __Pyx_INCREF(__pyx__function);
                    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
                    __pyx_t_6 = 0;
                  }
                  #endif
                  {
                    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_5};
                    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L13_error)
                    __Pyx_GOTREF(__pyx_t_1);
                  }
                  __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_output_names, __pyx_t_1); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 843, __pyx_L13_error)
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

                  /* "xpra/x11/bindings/randr.pyx":844
 *                                     if output_info!=NULL:
 *                                         output_names.append(decode_str(output_info.name))
 *                                         XRRFreeOutputInfo(output_info)             # <<<<<<<<<<<<<<
 *                                 log(f"refresh rate for {csv(output_names)} : {rate}")
 *                                 rates[crtc] = rate
*/
                  XRRFreeOutputInfo(__pyx_v_output_info);

                  /* "xpra/x11/bindings/randr.pyx":842
 *                                 for o in range(crtc_info.noutput):
 *                                     output_info = XRRGetOutputInfo(self.display, rsc, crtc_info.outputs[o])
 *                                     if output_info!=NULL:             # <<<<<<<<<<<<<<
 *                                         output_names.append(decode_str(output_info.name))
 *                                         XRRFreeOutputInfo(output_info)
*/
                }
              }

              /* "xpra/x11/bindings/randr.pyx":845
 *                                         output_names.append(decode_str(output_info.name))
 *                                         XRRFreeOutputInfo(output_info)
 *                                 log(f"refresh rate for {csv(output_names)} : {rate}")             # <<<<<<<<<<<<<<
 *                                 rates[crtc] = rate
 *                             break
*/
              __pyx_t_4 = NULL;
              __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 845, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_csv); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 845, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_output_names); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 845, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_rate, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_19[0] = __pyx_mstate_global->__pyx_kp_u_refresh_rate_for;
              __pyx_t_19[1] = __pyx_t_10;
              __pyx_t_19[2] = __pyx_mstate_global->__pyx_kp_u__2;
              __pyx_t_19[3] = __pyx_t_3;
              __pyx_t_20 = __Pyx_PyUnicode_Join(__pyx_t_19, 4, 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
              if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 845, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_20);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_6 = 1;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_5))) {
                __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
                assert(__pyx_t_4);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
                __pyx_t_6 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_20};
                __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L13_error)
                __Pyx_GOTREF(__pyx_t_1);
              }
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

              /* "xpra/x11/bindings/randr.pyx":846
 *                                         XRRFreeOutputInfo(output_info)
 *                                 log(f"refresh rate for {csv(output_names)} : {rate}")
 *                                 rates[crtc] = rate             # <<<<<<<<<<<<<<
 *                             break
 *                 finally:
*/
              __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_crtc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L13_error)
              __Pyx_GOTREF(__pyx_t_1);
              if (unlikely((PyDict_SetItem(__pyx_v_rates, __pyx_t_1, __pyx_v_rate) < 0))) __PYX_ERR(0, 846, __pyx_L13_error)
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

              /* "xpra/x11/bindings/randr.pyx":836
 *                         mode_info = &rsc.modes[i]
 *                         if mode_info.id==crtc_info.mode:
 *                             if mode_info.hTotal and mode_info.vTotal:             # <<<<<<<<<<<<<<
 *                                 rate = round(mode_info.dotClock / (mode_info.hTotal * mode_info.vTotal))
 *                                 #outputs affected:
*/
            }

            /* "xpra/x11/bindings/randr.pyx":847
 *                                 log(f"refresh rate for {csv(output_names)} : {rate}")
 *                                 rates[crtc] = rate
 *                             break             # <<<<<<<<<<<<<<
 *                 finally:
 *                     XRRFreeCrtcInfo(crtc_info)
*/
            goto __pyx_L16_break;

            /* "xpra/x11/bindings/randr.pyx":835
 *                     for i in range(rsc.nmode):
 *                         mode_info = &rsc.modes[i]
 *                         if mode_info.id==crtc_info.mode:             # <<<<<<<<<<<<<<
 *                             if mode_info.hTotal and mode_info.vTotal:
 *                                 rate = round(mode_info.dotClock / (mode_info.hTotal * mode_info.vTotal))
*/
          }
        }
        __pyx_L16_break:;
      }

      /* "xpra/x11/bindings/randr.pyx":849
 *                             break
 *                 finally:
 *                     XRRFreeCrtcInfo(crtc_info)             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenResources(rsc)
*/
      /*finally:*/ {
        /*normal exit:*/{
          XRRFreeCrtcInfo(__pyx_v_crtc_info);
          goto __pyx_L14;
        }
        __pyx_L13_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27);
          if ( unlikely(__Pyx_GetException(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
          __Pyx_XGOTREF(__pyx_t_22);
          __Pyx_XGOTREF(__pyx_t_23);
          __Pyx_XGOTREF(__pyx_t_24);
          __Pyx_XGOTREF(__pyx_t_25);
          __Pyx_XGOTREF(__pyx_t_26);
          __Pyx_XGOTREF(__pyx_t_27);
          __pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
          {
            XRRFreeCrtcInfo(__pyx_v_crtc_info);
          }
          __Pyx_XGIVEREF(__pyx_t_25);
          __Pyx_XGIVEREF(__pyx_t_26);
          __Pyx_XGIVEREF(__pyx_t_27);
          __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_26, __pyx_t_27);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_XGIVEREF(__pyx_t_24);
          __Pyx_ErrRestore(__pyx_t_22, __pyx_t_23, __pyx_t_24);
          __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
          __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_21;
          goto __pyx_L5_error;
        }
        __pyx_L14:;
      }
      __pyx_L7_continue:;
    }
  }

  /* "xpra/x11/bindings/randr.pyx":851
 *                     XRRFreeCrtcInfo(crtc_info)
 *         finally:
 *             XRRFreeScreenResources(rsc)             # <<<<<<<<<<<<<<
 *         return rates
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      XRRFreeScreenResources(__pyx_v_rsc);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_27 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_23, &__pyx_t_22);
      if ( unlikely(__Pyx_GetException(&__pyx_t_27, &__pyx_t_26, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_27, &__pyx_t_26, &__pyx_t_25);
      __Pyx_XGOTREF(__pyx_t_27);
      __Pyx_XGOTREF(__pyx_t_26);
      __Pyx_XGOTREF(__pyx_t_25);
      __Pyx_XGOTREF(__pyx_t_24);
      __Pyx_XGOTREF(__pyx_t_23);
      __Pyx_XGOTREF(__pyx_t_22);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_28 = __pyx_filename;
      {
        XRRFreeScreenResources(__pyx_v_rsc);
      }
      __Pyx_XGIVEREF(__pyx_t_24);
      __Pyx_XGIVEREF(__pyx_t_23);
      __Pyx_XGIVEREF(__pyx_t_22);
      __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_23, __pyx_t_22);
      __Pyx_XGIVEREF(__pyx_t_27);
      __Pyx_XGIVEREF(__pyx_t_26);
      __Pyx_XGIVEREF(__pyx_t_25);
      __Pyx_ErrRestore(__pyx_t_27, __pyx_t_26, __pyx_t_25);
      __pyx_t_27 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_28;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "xpra/x11/bindings/randr.pyx":852
 *         finally:
 *             XRRFreeScreenResources(rsc)
 *         return rates             # <<<<<<<<<<<<<<
 * 
 *     def set_screen_size(self, int width, int height) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rates);
  __pyx_r = __pyx_v_rates;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":815
 *             XRRFreeScreenConfigInfo(config)
 * 
 *     def get_vrefresh_outputs(self) -> Dict[int, int]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRROutputInfo *output_info = NULL
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_vrefresh_outputs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rates);
  __Pyx_XDECREF(__pyx_v_rate);
  __Pyx_XDECREF(__pyx_v_output_names);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":854
 *         return rates
 * 
 *     def set_screen_size(self, int width, int height) -> bool:             # <<<<<<<<<<<<<<
 *         return self._set_screen_size(width, height)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_35set_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_35set_screen_size = {"set_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_35set_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_35set_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_width;
  int __pyx_v_height;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_screen_size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_width,&__pyx_mstate_global->__pyx_n_u_height,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 854, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_screen_size", 0) < (0)) __PYX_ERR(0, 854, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_screen_size", 1, 2, 2, i); __PYX_ERR(0, 854, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 854, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 854, __pyx_L3_error)
    }
    __pyx_v_width = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 854, __pyx_L3_error)
    __pyx_v_height = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 854, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_screen_size", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 854, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.set_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_34set_screen_size(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), __pyx_v_width, __pyx_v_height);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_34set_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, int __pyx_v_width, int __pyx_v_height) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_screen_size", 0);

  /* "xpra/x11/bindings/randr.pyx":855
 * 
 *     def set_screen_size(self, int width, int height) -> bool:
 *         return self._set_screen_size(width, height)             # <<<<<<<<<<<<<<
 * 
 *     def add_screen_size(self, unsigned int w, unsigned int h, unsigned int vrefresh=DEFAULT_REFRESH_RATE) -> RRMode:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_screen_size(__pyx_v_self, __pyx_t_1, __pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":854
 *         return rates
 * 
 *     def set_screen_size(self, int width, int height) -> bool:             # <<<<<<<<<<<<<<
 *         return self._set_screen_size(width, height)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.set_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":857
 *         return self._set_screen_size(width, height)
 * 
 *     def add_screen_size(self, unsigned int w, unsigned int h, unsigned int vrefresh=DEFAULT_REFRESH_RATE) -> RRMode:             # <<<<<<<<<<<<<<
 *         hz = vrefresh / 1000
 *         hzstr = str(hz)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_37add_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_37add_screen_size = {"add_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_37add_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_37add_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  unsigned int __pyx_v_w;
  unsigned int __pyx_v_h;
  unsigned int __pyx_v_vrefresh;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_screen_size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_w,&__pyx_mstate_global->__pyx_n_u_h,&__pyx_mstate_global->__pyx_n_u_vrefresh,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 857, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 857, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 857, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 857, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add_screen_size", 0) < (0)) __PYX_ERR(0, 857, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_screen_size", 0, 2, 3, i); __PYX_ERR(0, 857, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 857, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 857, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 857, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = __Pyx_PyLong_As_unsigned_int(values[0]); if (unlikely((__pyx_v_w == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyLong_As_unsigned_int(values[1]); if (unlikely((__pyx_v_h == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_vrefresh = __Pyx_PyLong_As_unsigned_int(values[2]); if (unlikely((__pyx_v_vrefresh == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L3_error)
    } else {
      __pyx_v_vrefresh = __pyx_mstate_global->__pyx_k__7;
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_screen_size", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 857, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.add_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_36add_screen_size(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), __pyx_v_w, __pyx_v_h, __pyx_v_vrefresh);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_36add_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, unsigned int __pyx_v_w, unsigned int __pyx_v_h, unsigned int __pyx_v_vrefresh) {
  long __pyx_v_hz;
  PyObject *__pyx_v_hzstr = NULL;
  PyObject *__pyx_v_name = NULL;
  RRMode __pyx_v_mode;
  RROutput __pyx_v_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7[5];
  RRMode __pyx_t_8;
  RROutput __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14[6];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_screen_size", 0);

  /* "xpra/x11/bindings/randr.pyx":858
 * 
 *     def add_screen_size(self, unsigned int w, unsigned int h, unsigned int vrefresh=DEFAULT_REFRESH_RATE) -> RRMode:
 *         hz = vrefresh / 1000             # <<<<<<<<<<<<<<
 *         hzstr = str(hz)
 *         if hzstr.find(".") > 0:
*/
  __pyx_v_hz = (((long)__pyx_v_vrefresh) / 0x3E8);

  /* "xpra/x11/bindings/randr.pyx":859
 *     def add_screen_size(self, unsigned int w, unsigned int h, unsigned int vrefresh=DEFAULT_REFRESH_RATE) -> RRMode:
 *         hz = vrefresh / 1000
 *         hzstr = str(hz)             # <<<<<<<<<<<<<<
 *         if hzstr.find(".") > 0:
 *             hzstr = hzstr.rstrip("0").rstrip(".")
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_hz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hzstr = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":860
 *         hz = vrefresh / 1000
 *         hzstr = str(hz)
 *         if hzstr.find(".") > 0:             # <<<<<<<<<<<<<<
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         name = f"{w}x{h}@{hzstr}"
*/
  __pyx_t_3 = PyUnicode_Find(__pyx_v_hzstr, __pyx_mstate_global->__pyx_kp_u__4, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-2))) __PYX_ERR(0, 860, __pyx_L1_error)
  __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "xpra/x11/bindings/randr.pyx":861
 *         hzstr = str(hz)
 *         if hzstr.find(".") > 0:
 *             hzstr = hzstr.rstrip("0").rstrip(".")             # <<<<<<<<<<<<<<
 *         name = f"{w}x{h}@{hzstr}"
 *         mode = self.add_screen_mode(name, w, h, hz)
*/
    __pyx_t_5 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__rstrip, __pyx_v_hzstr, __pyx_mstate_global->__pyx_kp_u_0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__4};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_rstrip, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_hzstr, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":860
 *         hz = vrefresh / 1000
 *         hzstr = str(hz)
 *         if hzstr.find(".") > 0:             # <<<<<<<<<<<<<<
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         name = f"{w}x{h}@{hzstr}"
*/
  }

  /* "xpra/x11/bindings/randr.pyx":862
 *         if hzstr.find(".") > 0:
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         name = f"{w}x{h}@{hzstr}"             # <<<<<<<<<<<<<<
 *         mode = self.add_screen_mode(name, w, h, hz)
 *         #now add it to the output:
*/
  __pyx_t_1 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_w, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_h, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7[0] = __pyx_t_1;
  __pyx_t_7[1] = __pyx_mstate_global->__pyx_n_u_x;
  __pyx_t_7[2] = __pyx_t_5;
  __pyx_t_7[3] = __pyx_mstate_global->__pyx_kp_u__8;
  __pyx_t_7[4] = __pyx_v_hzstr;
  __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_7, 5, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_hzstr), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_hzstr));
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_name = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":863
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         name = f"{w}x{h}@{hzstr}"
 *         mode = self.add_screen_mode(name, w, h, hz)             # <<<<<<<<<<<<<<
 *         #now add it to the output:
 *         cdef RROutput output
*/
  __pyx_t_8 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->add_screen_mode(__pyx_v_self, __pyx_v_name, __pyx_v_w, __pyx_v_h, __pyx_v_hz); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L1_error)
  __pyx_v_mode = __pyx_t_8;

  /* "xpra/x11/bindings/randr.pyx":866
 *         #now add it to the output:
 *         cdef RROutput output
 *         if mode:             # <<<<<<<<<<<<<<
 *             output = self.get_current_output()
 *             log(f"adding mode {name!r} ({mode:#x}) to output {output:#x}")
*/
  __pyx_t_4 = (__pyx_v_mode != 0);
  if (__pyx_t_4) {

    /* "xpra/x11/bindings/randr.pyx":867
 *         cdef RROutput output
 *         if mode:
 *             output = self.get_current_output()             # <<<<<<<<<<<<<<
 *             log(f"adding mode {name!r} ({mode:#x}) to output {output:#x}")
 *             XRRAddOutputMode(self.display, output, mode)
*/
    __pyx_t_9 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_current_output(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L1_error)
    __pyx_v_output = __pyx_t_9;

    /* "xpra/x11/bindings/randr.pyx":868
 *         if mode:
 *             output = self.get_current_output()
 *             log(f"adding mode {name!r} ({mode:#x}) to output {output:#x}")             # <<<<<<<<<<<<<<
 *             XRRAddOutputMode(self.display, output, mode)
 *         return mode
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = __Pyx_PyObject_Format(__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_x_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyLong_From_unsigned_long(__pyx_v_output); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = __Pyx_PyObject_Format(__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_x_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_adding_mode;
    __pyx_t_14[1] = __pyx_t_10;
    __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u__9;
    __pyx_t_14[3] = __pyx_t_12;
    __pyx_t_14[4] = __pyx_mstate_global->__pyx_kp_u_to_output;
    __pyx_t_14[5] = __pyx_t_13;
    __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, 12 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_11};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 868, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":869
 *             output = self.get_current_output()
 *             log(f"adding mode {name!r} ({mode:#x}) to output {output:#x}")
 *             XRRAddOutputMode(self.display, output, mode)             # <<<<<<<<<<<<<<
 *         return mode
 * 
*/
    XRRAddOutputMode(__pyx_v_self->__pyx_base.display, __pyx_v_output, __pyx_v_mode);

    /* "xpra/x11/bindings/randr.pyx":866
 *         #now add it to the output:
 *         cdef RROutput output
 *         if mode:             # <<<<<<<<<<<<<<
 *             output = self.get_current_output()
 *             log(f"adding mode {name!r} ({mode:#x}) to output {output:#x}")
*/
  }

  /* "xpra/x11/bindings/randr.pyx":870
 *             log(f"adding mode {name!r} ({mode:#x}) to output {output:#x}")
 *             XRRAddOutputMode(self.display, output, mode)
 *         return mode             # <<<<<<<<<<<<<<
 * 
 *     cdef RRMode add_screen_mode(self, name, unsigned int w, unsigned int h, double hz):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":857
 *         return self._set_screen_size(width, height)
 * 
 *     def add_screen_size(self, unsigned int w, unsigned int h, unsigned int vrefresh=DEFAULT_REFRESH_RATE) -> RRMode:             # <<<<<<<<<<<<<<
 *         hz = vrefresh / 1000
 *         hzstr = str(hz)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.add_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_hzstr);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":872
 *         return mode
 * 
 *     cdef RRMode add_screen_mode(self, name, unsigned int w, unsigned int h, double hz):             # <<<<<<<<<<<<<<
 *         self.context_check("add_screen_mode")
 *         log("add_screen_mode(%s, %i, %i, %i)", name, w, h, hz)
*/

static RRMode __pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_add_screen_mode(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_name, unsigned int __pyx_v_w, unsigned int __pyx_v_h, double __pyx_v_hz) {
  XRRModeInfo *__pyx_v_new_mode;
  RRMode __pyx_v_mode;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  PyObject *__pyx_v_mode_info = NULL;
  PyObject *__pyx_v_rname = NULL;
  PyObject *__pyx_v_rmode = NULL;
  RRMode __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  RRMode __pyx_t_9;
  PyObject *__pyx_t_10[3];
  int __pyx_t_11;
  int __pyx_t_12;
  char const *__pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *(*__pyx_t_23)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_screen_mode", 0);

  /* "xpra/x11/bindings/randr.pyx":873
 * 
 *     cdef RRMode add_screen_mode(self, name, unsigned int w, unsigned int h, double hz):
 *         self.context_check("add_screen_mode")             # <<<<<<<<<<<<<<
 *         log("add_screen_mode(%s, %i, %i, %i)", name, w, h, hz)
 *         cdef XRRModeInfo *new_mode = self.calculate_mode(name, w, h, hz)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_add_screen_mode};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":874
 *     cdef RRMode add_screen_mode(self, name, unsigned int w, unsigned int h, double hz):
 *         self.context_check("add_screen_mode")
 *         log("add_screen_mode(%s, %i, %i, %i)", name, w, h, hz)             # <<<<<<<<<<<<<<
 *         cdef XRRModeInfo *new_mode = self.calculate_mode(name, w, h, hz)
 *         assert new_mode!=NULL
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_hz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_add_screen_mode_s_i_i_i, __pyx_v_name, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (6-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 874, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":875
 *         self.context_check("add_screen_mode")
 *         log("add_screen_mode(%s, %i, %i, %i)", name, w, h, hz)
 *         cdef XRRModeInfo *new_mode = self.calculate_mode(name, w, h, hz)             # <<<<<<<<<<<<<<
 *         assert new_mode!=NULL
 *         cdef RRMode mode = self._added_modes.get(name, 0)
*/
  __pyx_v_new_mode = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->calculate_mode(__pyx_v_self, __pyx_v_name, __pyx_v_w, __pyx_v_h, __pyx_v_hz);

  /* "xpra/x11/bindings/randr.pyx":876
 *         log("add_screen_mode(%s, %i, %i, %i)", name, w, h, hz)
 *         cdef XRRModeInfo *new_mode = self.calculate_mode(name, w, h, hz)
 *         assert new_mode!=NULL             # <<<<<<<<<<<<<<
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_8 = (__pyx_v_new_mode != NULL);
    if (unlikely(!__pyx_t_8)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 876, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 876, __pyx_L1_error)
  #endif

  /* "xpra/x11/bindings/randr.pyx":877
 *         cdef XRRModeInfo *new_mode = self.calculate_mode(name, w, h, hz)
 *         assert new_mode!=NULL
 *         cdef RRMode mode = self._added_modes.get(name, 0)             # <<<<<<<<<<<<<<
 *         if mode:
 *             return mode
*/
  __pyx_t_4 = __pyx_v_self->_added_modes;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_name, __pyx_mstate_global->__pyx_int_0};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_9 = __Pyx_PyLong_As_unsigned_long(__pyx_t_1); if (unlikely((__pyx_t_9 == ((RRMode)-1)) && PyErr_Occurred())) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mode = __pyx_t_9;

  /* "xpra/x11/bindings/randr.pyx":878
 *         assert new_mode!=NULL
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode:             # <<<<<<<<<<<<<<
 *             return mode
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
  __pyx_t_8 = (__pyx_v_mode != 0);
  if (__pyx_t_8) {

    /* "xpra/x11/bindings/randr.pyx":879
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode:
 *             return mode             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         try:
*/
    __pyx_r = __pyx_v_mode;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":878
 *         assert new_mode!=NULL
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode:             # <<<<<<<<<<<<<<
 *             return mode
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":880
 *         if mode:
 *             return mode
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         try:
 *             mode_info = get_mode_info(new_mode, True)
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":881
 *             return mode
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         try:             # <<<<<<<<<<<<<<
 *             mode_info = get_mode_info(new_mode, True)
 *             mode = XRRCreateMode(self.display, window, new_mode)
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":882
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         try:
 *             mode_info = get_mode_info(new_mode, True)             # <<<<<<<<<<<<<<
 *             mode = XRRCreateMode(self.display, window, new_mode)
 *             log(f"XRRCreateMode returned {mode:#x} for mode %s", mode_info)
*/
    __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info(__pyx_v_new_mode, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_mode_info = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":883
 *         try:
 *             mode_info = get_mode_info(new_mode, True)
 *             mode = XRRCreateMode(self.display, window, new_mode)             # <<<<<<<<<<<<<<
 *             log(f"XRRCreateMode returned {mode:#x} for mode %s", mode_info)
 *             if mode<=0:
*/
    __pyx_v_mode = XRRCreateMode(__pyx_v_self->__pyx_base.display, __pyx_v_window, __pyx_v_new_mode);

    /* "xpra/x11/bindings/randr.pyx":884
 *             mode_info = get_mode_info(new_mode, True)
 *             mode = XRRCreateMode(self.display, window, new_mode)
 *             log(f"XRRCreateMode returned {mode:#x} for mode %s", mode_info)             # <<<<<<<<<<<<<<
 *             if mode<=0:
 *                 return 0
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 884, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 884, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_x_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 884, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_XRRCreateMode_returned;
    __pyx_t_10[1] = __pyx_t_5;
    __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_for_mode_s;
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, 23 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 12, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 884, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_6, __pyx_v_mode_info};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":885
 *             mode = XRRCreateMode(self.display, window, new_mode)
 *             log(f"XRRCreateMode returned {mode:#x} for mode %s", mode_info)
 *             if mode<=0:             # <<<<<<<<<<<<<<
 *                 return 0
 *             self._added_modes[name] = int(mode)
*/
    __pyx_t_8 = (__pyx_v_mode <= 0);
    if (__pyx_t_8) {

      /* "xpra/x11/bindings/randr.pyx":886
 *             log(f"XRRCreateMode returned {mode:#x} for mode %s", mode_info)
 *             if mode<=0:
 *                 return 0             # <<<<<<<<<<<<<<
 *             self._added_modes[name] = int(mode)
 *         finally:
*/
      __pyx_r = 0;
      goto __pyx_L4_return;

      /* "xpra/x11/bindings/randr.pyx":885
 *             mode = XRRCreateMode(self.display, window, new_mode)
 *             log(f"XRRCreateMode returned {mode:#x} for mode %s", mode_info)
 *             if mode<=0:             # <<<<<<<<<<<<<<
 *                 return 0
 *             self._added_modes[name] = int(mode)
*/
    }

    /* "xpra/x11/bindings/randr.pyx":887
 *             if mode<=0:
 *                 return 0
 *             self._added_modes[name] = int(mode)             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeModeInfo(new_mode)
*/
    __pyx_t_7 = NULL;
    __pyx_t_6 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 887, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (unlikely((PyObject_SetItem(__pyx_v_self->_added_modes, __pyx_v_name, __pyx_t_1) < 0))) __PYX_ERR(0, 887, __pyx_L5_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "xpra/x11/bindings/randr.pyx":889
 *             self._added_modes[name] = int(mode)
 *         finally:
 *             XRRFreeModeInfo(new_mode)             # <<<<<<<<<<<<<<
 *         if len(self._added_modes)>MAX_NEW_MODES:
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))
*/
  /*finally:*/ {
    /*normal exit:*/{
      XRRFreeModeInfo(__pyx_v_new_mode);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
      if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
      {
        XRRFreeModeInfo(__pyx_v_new_mode);
      }
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_9 = __pyx_r;
      XRRFreeModeInfo(__pyx_v_new_mode);
      __pyx_r = __pyx_t_9;
      goto __pyx_L0;
    }
    __pyx_L6:;
  }

  /* "xpra/x11/bindings/randr.pyx":890
 *         finally:
 *             XRRFreeModeInfo(new_mode)
 *         if len(self._added_modes)>MAX_NEW_MODES:             # <<<<<<<<<<<<<<
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))
 *             log("added modes=%s", csv(self._added_modes.items()))
*/
  __pyx_t_1 = __pyx_v_self->_added_modes;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_20 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_t_20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_MAX_NEW_MODES); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_8) {

    /* "xpra/x11/bindings/randr.pyx":891
 *             XRRFreeModeInfo(new_mode)
 *         if len(self._added_modes)>MAX_NEW_MODES:
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))             # <<<<<<<<<<<<<<
 *             log("added modes=%s", csv(self._added_modes.items()))
 *             try:
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_self->_added_modes;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_20 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_20); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_too_many_new_modes_i_trying_to_r, __pyx_t_4};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "xpra/x11/bindings/randr.pyx":892
 *         if len(self._added_modes)>MAX_NEW_MODES:
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))
 *             log("added modes=%s", csv(self._added_modes.items()))             # <<<<<<<<<<<<<<
 *             try:
 *                 rname, rmode = tuple(self._added_modes.items())[0]
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_csv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_22 = __pyx_v_self->_added_modes;
    __Pyx_INCREF(__pyx_t_22);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_22, NULL};
      __pyx_t_21 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
    }
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_21};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_added_modes_s, __pyx_t_6};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "xpra/x11/bindings/randr.pyx":893
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))
 *             log("added modes=%s", csv(self._added_modes.items()))
 *             try:             # <<<<<<<<<<<<<<
 *                 rname, rmode = tuple(self._added_modes.items())[0]
 *                 self.remove_mode(rmode)
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_19, &__pyx_t_18, &__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_17);
      /*try:*/ {

        /* "xpra/x11/bindings/randr.pyx":894
 *             log("added modes=%s", csv(self._added_modes.items()))
 *             try:
 *                 rname, rmode = tuple(self._added_modes.items())[0]             # <<<<<<<<<<<<<<
 *                 self.remove_mode(rmode)
 *                 del self._added_modes[rname]
*/
        __pyx_t_4 = __pyx_v_self->_added_modes;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 894, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 894, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
          PyObject* sequence = __pyx_t_7;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 894, __pyx_L11_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
            __Pyx_INCREF(__pyx_t_4);
            __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
            __Pyx_INCREF(__pyx_t_6);
          } else {
            __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L11_error)
            __Pyx_XGOTREF(__pyx_t_4);
            __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 894, __pyx_L11_error)
            __Pyx_XGOTREF(__pyx_t_6);
          }
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 894, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 894, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1);
          index = 0; __pyx_t_4 = __pyx_t_23(__pyx_t_1); if (unlikely(!__pyx_t_4)) goto __pyx_L17_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_4);
          index = 1; __pyx_t_6 = __pyx_t_23(__pyx_t_1); if (unlikely(!__pyx_t_6)) goto __pyx_L17_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_6);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_23(__pyx_t_1), 2) < (0)) __PYX_ERR(0, 894, __pyx_L11_error)
          __pyx_t_23 = NULL;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L18_unpacking_done;
          __pyx_L17_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_23 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 894, __pyx_L11_error)
          __pyx_L18_unpacking_done:;
        }
        __pyx_v_rname = __pyx_t_4;
        __pyx_t_4 = 0;
        __pyx_v_rmode = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "xpra/x11/bindings/randr.pyx":895
 *             try:
 *                 rname, rmode = tuple(self._added_modes.items())[0]
 *                 self.remove_mode(rmode)             # <<<<<<<<<<<<<<
 *                 del self._added_modes[rname]
 *             except:
*/
        __pyx_t_6 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_rmode};
          __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_remove_mode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 895, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "xpra/x11/bindings/randr.pyx":896
 *                 rname, rmode = tuple(self._added_modes.items())[0]
 *                 self.remove_mode(rmode)
 *                 del self._added_modes[rname]             # <<<<<<<<<<<<<<
 *             except:
 *                 log("failed to remove older mode", exc_info=True)
*/
        if (unlikely((PyObject_DelItem(__pyx_v_self->_added_modes, __pyx_v_rname) < 0))) __PYX_ERR(0, 896, __pyx_L11_error)

        /* "xpra/x11/bindings/randr.pyx":893
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))
 *             log("added modes=%s", csv(self._added_modes.items()))
 *             try:             # <<<<<<<<<<<<<<
 *                 rname, rmode = tuple(self._added_modes.items())[0]
 *                 self.remove_mode(rmode)
*/
      }
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      goto __pyx_L16_try_end;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "xpra/x11/bindings/randr.pyx":897
 *                 self.remove_mode(rmode)
 *                 del self._added_modes[rname]
 *             except:             # <<<<<<<<<<<<<<
 *                 log("failed to remove older mode", exc_info=True)
 *         return mode
*/
      /*except:*/ {
        __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.add_screen_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_4) < 0) __PYX_ERR(0, 897, __pyx_L13_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_4);

        /* "xpra/x11/bindings/randr.pyx":898
 *                 del self._added_modes[rname]
 *             except:
 *                 log("failed to remove older mode", exc_info=True)             # <<<<<<<<<<<<<<
 *         return mode
 * 
*/
        __pyx_t_2 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 898, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_21);
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_21))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_21);
          assert(__pyx_t_2);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_21, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_failed_to_remove_older_mode};
          __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 898, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exc_info, Py_True, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 898, __pyx_L13_except_error)
          __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_21, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L12_exception_handled;
      }

      /* "xpra/x11/bindings/randr.pyx":893
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))
 *             log("added modes=%s", csv(self._added_modes.items()))
 *             try:             # <<<<<<<<<<<<<<
 *                 rname, rmode = tuple(self._added_modes.items())[0]
 *                 self.remove_mode(rmode)
*/
      __pyx_L13_except_error:;
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_18, __pyx_t_17);
      goto __pyx_L1_error;
      __pyx_L12_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_18, __pyx_t_17);
      __pyx_L16_try_end:;
    }

    /* "xpra/x11/bindings/randr.pyx":890
 *         finally:
 *             XRRFreeModeInfo(new_mode)
 *         if len(self._added_modes)>MAX_NEW_MODES:             # <<<<<<<<<<<<<<
 *             log("too many new modes (%i), trying to remove the oldest entry", len(self._added_modes))
 *             log("added modes=%s", csv(self._added_modes.items()))
*/
  }

  /* "xpra/x11/bindings/randr.pyx":899
 *             except:
 *                 log("failed to remove older mode", exc_info=True)
 *         return mode             # <<<<<<<<<<<<<<
 * 
 *     cdef XRRModeInfo *calculate_mode(self, name, unsigned int w, unsigned int h, double vrefresh) noexcept:
*/
  __pyx_r = __pyx_v_mode;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":872
 *         return mode
 * 
 *     cdef RRMode add_screen_mode(self, name, unsigned int w, unsigned int h, double hz):             # <<<<<<<<<<<<<<
 *         self.context_check("add_screen_mode")
 *         log("add_screen_mode(%s, %i, %i, %i)", name, w, h, hz)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.add_screen_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mode_info);
  __Pyx_XDECREF(__pyx_v_rname);
  __Pyx_XDECREF(__pyx_v_rmode);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":901
 *         return mode
 * 
 *     cdef XRRModeInfo *calculate_mode(self, name, unsigned int w, unsigned int h, double vrefresh) noexcept:             # <<<<<<<<<<<<<<
 *         log("calculate_mode(%s, %i, %i, %f)", name, w, h, vrefresh)
 *         if vrefresh <= 0 or vrefresh > 500:
*/

static XRRModeInfo *__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_calculate_mode(CYTHON_UNUSED struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_name, unsigned int __pyx_v_w, unsigned int __pyx_v_h, double __pyx_v_vrefresh) {
  unsigned int __pyx_v_minHSync;
  unsigned int __pyx_v_maxHSync;
  unsigned int __pyx_v_minVSync;
  unsigned int __pyx_v_maxVSync;
  double __pyx_v_idealVSync;
  double __pyx_v_timeHFront;
  double __pyx_v_timeHSync;
  double __pyx_v_timeHBack;
  double __pyx_v_timeVBack;
  double __pyx_v_yFactor;
  PyObject *__pyx_v_bname = NULL;
  XRRModeInfo *__pyx_v_mode;
  PyObject *__pyx_v_xFront = NULL;
  PyObject *__pyx_v_xSync = NULL;
  PyObject *__pyx_v_xBack = NULL;
  PyObject *__pyx_v_xTotal = NULL;
  PyObject *__pyx_v_yFront = NULL;
  PyObject *__pyx_v_ySync = NULL;
  PyObject *__pyx_v_yBack = NULL;
  PyObject *__pyx_v_yTotal = NULL;
  PyObject *__pyx_v_maxPixelClock = NULL;
  PyObject *__pyx_v_modeMaxClock = NULL;
  PyObject *__pyx_v_modeMinClock = NULL;
  PyObject *__pyx_v_idealClock = NULL;
  unsigned long __pyx_v_clock;
  PyObject *__pyx_v_hzstr = NULL;
  XRRModeInfo *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  char *__pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12[5];
  unsigned long __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  unsigned int __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("calculate_mode", 0);

  /* "xpra/x11/bindings/randr.pyx":902
 * 
 *     cdef XRRModeInfo *calculate_mode(self, name, unsigned int w, unsigned int h, double vrefresh) noexcept:
 *         log("calculate_mode(%s, %i, %i, %f)", name, w, h, vrefresh)             # <<<<<<<<<<<<<<
 *         if vrefresh <= 0 or vrefresh > 500:
 *             log.warn("Warning: invalid vertical refresh rate specified: %i", vrefresh)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_vrefresh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_calculate_mode_s_i_i_f, __pyx_v_name, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_7, (6-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":903
 *     cdef XRRModeInfo *calculate_mode(self, name, unsigned int w, unsigned int h, double vrefresh) noexcept:
 *         log("calculate_mode(%s, %i, %i, %f)", name, w, h, vrefresh)
 *         if vrefresh <= 0 or vrefresh > 500:             # <<<<<<<<<<<<<<
 *             log.warn("Warning: invalid vertical refresh rate specified: %i", vrefresh)
 *         #monitor settings as set in xorg.conf...
*/
  __pyx_t_9 = (__pyx_v_vrefresh <= 0.0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_8 = __pyx_t_9;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_vrefresh > 500.0);
  __pyx_t_8 = __pyx_t_9;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_8) {

    /* "xpra/x11/bindings/randr.pyx":904
 *         log("calculate_mode(%s, %i, %i, %f)", name, w, h, vrefresh)
 *         if vrefresh <= 0 or vrefresh > 500:
 *             log.warn("Warning: invalid vertical refresh rate specified: %i", vrefresh)             # <<<<<<<<<<<<<<
 *         #monitor settings as set in xorg.conf...
 *         cdef unsigned int minHSync = 1*1000                     #1KHz
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_vrefresh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Warning_invalid_vertical_refresh, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":903
 *     cdef XRRModeInfo *calculate_mode(self, name, unsigned int w, unsigned int h, double vrefresh) noexcept:
 *         log("calculate_mode(%s, %i, %i, %f)", name, w, h, vrefresh)
 *         if vrefresh <= 0 or vrefresh > 500:             # <<<<<<<<<<<<<<
 *             log.warn("Warning: invalid vertical refresh rate specified: %i", vrefresh)
 *         #monitor settings as set in xorg.conf...
*/
  }

  /* "xpra/x11/bindings/randr.pyx":906
 *             log.warn("Warning: invalid vertical refresh rate specified: %i", vrefresh)
 *         #monitor settings as set in xorg.conf...
 *         cdef unsigned int minHSync = 1*1000                     #1KHz             # <<<<<<<<<<<<<<
 *         cdef unsigned int maxHSync = 300*1000                   #300KHz
 *         cdef unsigned int minVSync = 1                          #1Hz
*/
  __pyx_v_minHSync = 0x3e8;

  /* "xpra/x11/bindings/randr.pyx":907
 *         #monitor settings as set in xorg.conf...
 *         cdef unsigned int minHSync = 1*1000                     #1KHz
 *         cdef unsigned int maxHSync = 300*1000                   #300KHz             # <<<<<<<<<<<<<<
 *         cdef unsigned int minVSync = 1                          #1Hz
 *         cdef unsigned int maxVSync = 300                        #240Hz
*/
  __pyx_v_maxHSync = 0x493e0;

  /* "xpra/x11/bindings/randr.pyx":908
 *         cdef unsigned int minHSync = 1*1000                     #1KHz
 *         cdef unsigned int maxHSync = 300*1000                   #300KHz
 *         cdef unsigned int minVSync = 1                          #1Hz             # <<<<<<<<<<<<<<
 *         cdef unsigned int maxVSync = 300                        #240Hz
 *         cdef double idealVSync = vrefresh
*/
  __pyx_v_minVSync = 1;

  /* "xpra/x11/bindings/randr.pyx":909
 *         cdef unsigned int maxHSync = 300*1000                   #300KHz
 *         cdef unsigned int minVSync = 1                          #1Hz
 *         cdef unsigned int maxVSync = 300                        #240Hz             # <<<<<<<<<<<<<<
 *         cdef double idealVSync = vrefresh
 *         cdef double timeHFront = 0.07           #0.074219; 0.075; Width of the black border on right edge of the screen
*/
  __pyx_v_maxVSync = 0x12C;

  /* "xpra/x11/bindings/randr.pyx":910
 *         cdef unsigned int minVSync = 1                          #1Hz
 *         cdef unsigned int maxVSync = 300                        #240Hz
 *         cdef double idealVSync = vrefresh             # <<<<<<<<<<<<<<
 *         cdef double timeHFront = 0.07           #0.074219; 0.075; Width of the black border on right edge of the screen
 *         cdef double timeHSync = 0.1             #0.107422; 0.1125; Sync pulse duration
*/
  __pyx_v_idealVSync = __pyx_v_vrefresh;

  /* "xpra/x11/bindings/randr.pyx":911
 *         cdef unsigned int maxVSync = 300                        #240Hz
 *         cdef double idealVSync = vrefresh
 *         cdef double timeHFront = 0.07           #0.074219; 0.075; Width of the black border on right edge of the screen             # <<<<<<<<<<<<<<
 *         cdef double timeHSync = 0.1             #0.107422; 0.1125; Sync pulse duration
 *         cdef double timeHBack = 0.15            #0.183594; 0.1875; Width of the black border on left edge of the screen
*/
  __pyx_v_timeHFront = 0.07;

  /* "xpra/x11/bindings/randr.pyx":912
 *         cdef double idealVSync = vrefresh
 *         cdef double timeHFront = 0.07           #0.074219; 0.075; Width of the black border on right edge of the screen
 *         cdef double timeHSync = 0.1             #0.107422; 0.1125; Sync pulse duration             # <<<<<<<<<<<<<<
 *         cdef double timeHBack = 0.15            #0.183594; 0.1875; Width of the black border on left edge of the screen
 *         cdef double timeVBack = 0.06            #0.031901; 0.055664; // Adjust this to move picture up/down
*/
  __pyx_v_timeHSync = 0.1;

  /* "xpra/x11/bindings/randr.pyx":913
 *         cdef double timeHFront = 0.07           #0.074219; 0.075; Width of the black border on right edge of the screen
 *         cdef double timeHSync = 0.1             #0.107422; 0.1125; Sync pulse duration
 *         cdef double timeHBack = 0.15            #0.183594; 0.1875; Width of the black border on left edge of the screen             # <<<<<<<<<<<<<<
 *         cdef double timeVBack = 0.06            #0.031901; 0.055664; // Adjust this to move picture up/down
 *         cdef double yFactor = 1                 #no interlace (0.5) or doublescan (2)
*/
  __pyx_v_timeHBack = 0.15;

  /* "xpra/x11/bindings/randr.pyx":914
 *         cdef double timeHSync = 0.1             #0.107422; 0.1125; Sync pulse duration
 *         cdef double timeHBack = 0.15            #0.183594; 0.1875; Width of the black border on left edge of the screen
 *         cdef double timeVBack = 0.06            #0.031901; 0.055664; // Adjust this to move picture up/down             # <<<<<<<<<<<<<<
 *         cdef double yFactor = 1                 #no interlace (0.5) or doublescan (2)
 * 
*/
  __pyx_v_timeVBack = 0.06;

  /* "xpra/x11/bindings/randr.pyx":915
 *         cdef double timeHBack = 0.15            #0.183594; 0.1875; Width of the black border on left edge of the screen
 *         cdef double timeVBack = 0.06            #0.031901; 0.055664; // Adjust this to move picture up/down
 *         cdef double yFactor = 1                 #no interlace (0.5) or doublescan (2)             # <<<<<<<<<<<<<<
 * 
 *         bname = name.encode("latin1")
*/
  __pyx_v_yFactor = 1.0;

  /* "xpra/x11/bindings/randr.pyx":917
 *         cdef double yFactor = 1                 #no interlace (0.5) or doublescan (2)
 * 
 *         bname = name.encode("latin1")             # <<<<<<<<<<<<<<
 *         cdef XRRModeInfo *mode = XRRAllocModeInfo(bname, len(bname))
 *         assert mode!=NULL
*/
  __pyx_t_5 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_latin1};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_bname = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":918
 * 
 *         bname = name.encode("latin1")
 *         cdef XRRModeInfo *mode = XRRAllocModeInfo(bname, len(bname))             # <<<<<<<<<<<<<<
 *         assert mode!=NULL
 * 
*/
  __pyx_t_10 = __Pyx_PyObject_AsWritableString(__pyx_v_bname); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L1_error)
  __pyx_t_11 = PyObject_Length(__pyx_v_bname); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 918, __pyx_L1_error)
  __pyx_v_mode = XRRAllocModeInfo(__pyx_t_10, __pyx_t_11);

  /* "xpra/x11/bindings/randr.pyx":919
 *         bname = name.encode("latin1")
 *         cdef XRRModeInfo *mode = XRRAllocModeInfo(bname, len(bname))
 *         assert mode!=NULL             # <<<<<<<<<<<<<<
 * 
 *         xFront = round(w * timeHFront)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_8 = (__pyx_v_mode != NULL);
    if (unlikely(!__pyx_t_8)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 919, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 919, __pyx_L1_error)
  #endif

  /* "xpra/x11/bindings/randr.pyx":921
 *         assert mode!=NULL
 * 
 *         xFront = round(w * timeHFront)             # <<<<<<<<<<<<<<
 *         xSync = round(w * timeHSync)
 *         xBack = round(w * timeHBack)
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = PyFloat_FromDouble((__pyx_v_w * __pyx_v_timeHFront)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_xFront = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":922
 * 
 *         xFront = round(w * timeHFront)
 *         xSync = round(w * timeHSync)             # <<<<<<<<<<<<<<
 *         xBack = round(w * timeHBack)
 *         xTotal = w + xFront + xSync + xBack
*/
  __pyx_t_6 = NULL;
  __pyx_t_5 = PyFloat_FromDouble((__pyx_v_w * __pyx_v_timeHSync)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_xSync = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":923
 *         xFront = round(w * timeHFront)
 *         xSync = round(w * timeHSync)
 *         xBack = round(w * timeHBack)             # <<<<<<<<<<<<<<
 *         xTotal = w + xFront + xSync + xBack
 *         yFront = 1
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = PyFloat_FromDouble((__pyx_v_w * __pyx_v_timeHBack)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_xBack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":924
 *         xSync = round(w * timeHSync)
 *         xBack = round(w * timeHBack)
 *         xTotal = w + xFront + xSync + xBack             # <<<<<<<<<<<<<<
 *         yFront = 1
 *         ySync = 3
*/
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_v_xFront); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_v_xSync); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_v_xBack); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_xTotal = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "xpra/x11/bindings/randr.pyx":925
 *         xBack = round(w * timeHBack)
 *         xTotal = w + xFront + xSync + xBack
 *         yFront = 1             # <<<<<<<<<<<<<<
 *         ySync = 3
 *         yBack = round(h * timeVBack)
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
  __pyx_v_yFront = __pyx_mstate_global->__pyx_int_1;

  /* "xpra/x11/bindings/randr.pyx":926
 *         xTotal = w + xFront + xSync + xBack
 *         yFront = 1
 *         ySync = 3             # <<<<<<<<<<<<<<
 *         yBack = round(h * timeVBack)
 *         yTotal = h + yFront + ySync + yBack
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_3);
  __pyx_v_ySync = __pyx_mstate_global->__pyx_int_3;

  /* "xpra/x11/bindings/randr.pyx":927
 *         yFront = 1
 *         ySync = 3
 *         yBack = round(h * timeVBack)             # <<<<<<<<<<<<<<
 *         yTotal = h + yFront + ySync + yBack
 * 
*/
  __pyx_t_1 = NULL;
  __pyx_t_5 = PyFloat_FromDouble((__pyx_v_h * __pyx_v_timeVBack)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_v_yBack = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "xpra/x11/bindings/randr.pyx":928
 *         ySync = 3
 *         yBack = round(h * timeVBack)
 *         yTotal = h + yFront + ySync + yBack             # <<<<<<<<<<<<<<
 * 
 *         if sizeof(long)<=4:
*/
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_yFront); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v_ySync); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_yBack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_yTotal = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "xpra/x11/bindings/randr.pyx":930
 *         yTotal = h + yFront + ySync + yBack
 * 
 *         if sizeof(long)<=4:             # <<<<<<<<<<<<<<
 *             maxPixelClock = 0xffffffff
 *         else:
*/
  __pyx_t_8 = ((sizeof(long)) <= 4);
  if (__pyx_t_8) {

    /* "xpra/x11/bindings/randr.pyx":931
 * 
 *         if sizeof(long)<=4:
 *             maxPixelClock = 0xffffffff             # <<<<<<<<<<<<<<
 *         else:
 *             maxPixelClock = 30*1000*1000*1000    #30,000 MHz
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_4294967295);
    __pyx_v_maxPixelClock = __pyx_mstate_global->__pyx_int_4294967295;

    /* "xpra/x11/bindings/randr.pyx":930
 *         yTotal = h + yFront + ySync + yBack
 * 
 *         if sizeof(long)<=4:             # <<<<<<<<<<<<<<
 *             maxPixelClock = 0xffffffff
 *         else:
*/
    goto __pyx_L6;
  }

  /* "xpra/x11/bindings/randr.pyx":933
 *             maxPixelClock = 0xffffffff
 *         else:
 *             maxPixelClock = 30*1000*1000*1000    #30,000 MHz             # <<<<<<<<<<<<<<
 *         modeMaxClock = min(maxPixelClock, maxHSync * xTotal, maxVSync * xTotal * yTotal * yFactor)
 *         modeMinClock = max(minHSync * xTotal, minVSync * xTotal * yTotal * yFactor)
*/
  /*else*/ {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_30000000000);
    __pyx_v_maxPixelClock = __pyx_mstate_global->__pyx_int_30000000000;
  }
  __pyx_L6:;

  /* "xpra/x11/bindings/randr.pyx":934
 *         else:
 *             maxPixelClock = 30*1000*1000*1000    #30,000 MHz
 *         modeMaxClock = min(maxPixelClock, maxHSync * xTotal, maxVSync * xTotal * yTotal * yFactor)             # <<<<<<<<<<<<<<
 *         modeMinClock = max(minHSync * xTotal, minVSync * xTotal * yTotal * yFactor)
 *         # If minimum clock > maximum clock, the mode is impossible...
*/
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_maxHSync); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_v_xTotal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_maxVSync); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v_xTotal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_yTotal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_yFactor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_v_maxPixelClock);
  __pyx_t_1 = __pyx_v_maxPixelClock;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_t_3;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_modeMaxClock = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "xpra/x11/bindings/randr.pyx":935
 *             maxPixelClock = 30*1000*1000*1000    #30,000 MHz
 *         modeMaxClock = min(maxPixelClock, maxHSync * xTotal, maxVSync * xTotal * yTotal * yFactor)
 *         modeMinClock = max(minHSync * xTotal, minVSync * xTotal * yTotal * yFactor)             # <<<<<<<<<<<<<<
 *         # If minimum clock > maximum clock, the mode is impossible...
 *         if modeMinClock > modeMaxClock:
*/
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_int(__pyx_v_minVSync); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_v_xTotal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_v_yTotal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_yFactor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_minHSync); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_v_xTotal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_t_3;
  } else {
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_modeMinClock = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "xpra/x11/bindings/randr.pyx":937
 *         modeMinClock = max(minHSync * xTotal, minVSync * xTotal * yTotal * yFactor)
 *         # If minimum clock > maximum clock, the mode is impossible...
 *         if modeMinClock > modeMaxClock:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: cannot add mode {name}")
 *             log.warn(f" clock {modeMinClock}Hz is above maximum value {modeMaxClock}Hz")
*/
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_modeMinClock, __pyx_v_modeMaxClock, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_8) {

    /* "xpra/x11/bindings/randr.pyx":938
 *         # If minimum clock > maximum clock, the mode is impossible...
 *         if modeMinClock > modeMaxClock:
 *             log.warn(f"Warning: cannot add mode {name}")             # <<<<<<<<<<<<<<
 *             log.warn(f" clock {modeMinClock}Hz is above maximum value {modeMaxClock}Hz")
 *             log.warn(" no suitable clocks could be found")
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Warning_cannot_add_mode, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":939
 *         if modeMinClock > modeMaxClock:
 *             log.warn(f"Warning: cannot add mode {name}")
 *             log.warn(f" clock {modeMinClock}Hz is above maximum value {modeMaxClock}Hz")             # <<<<<<<<<<<<<<
 *             log.warn(" no suitable clocks could be found")
 *             return NULL
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_modeMinClock, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_modeMaxClock, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u_clock;
    __pyx_t_12[1] = __pyx_t_4;
    __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u_Hz_is_above_maximum_value;
    __pyx_t_12[3] = __pyx_t_6;
    __pyx_t_12[4] = __pyx_mstate_global->__pyx_n_u_Hz;
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_12, 5, 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":940
 *             log.warn(f"Warning: cannot add mode {name}")
 *             log.warn(f" clock {modeMinClock}Hz is above maximum value {modeMaxClock}Hz")
 *             log.warn(" no suitable clocks could be found")             # <<<<<<<<<<<<<<
 *             return NULL
 * 
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_no_suitable_clocks_could_be_fou};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/x11/bindings/randr.pyx":941
 *             log.warn(f" clock {modeMinClock}Hz is above maximum value {modeMaxClock}Hz")
 *             log.warn(" no suitable clocks could be found")
 *             return NULL             # <<<<<<<<<<<<<<
 * 
 *         idealClock = idealVSync * xTotal * yTotal * yFactor
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":937
 *         modeMinClock = max(minHSync * xTotal, minVSync * xTotal * yTotal * yFactor)
 *         # If minimum clock > maximum clock, the mode is impossible...
 *         if modeMinClock > modeMaxClock:             # <<<<<<<<<<<<<<
 *             log.warn(f"Warning: cannot add mode {name}")
 *             log.warn(f" clock {modeMinClock}Hz is above maximum value {modeMaxClock}Hz")
*/
  }

  /* "xpra/x11/bindings/randr.pyx":943
 *             return NULL
 * 
 *         idealClock = idealVSync * xTotal * yTotal * yFactor             # <<<<<<<<<<<<<<
 *         cdef unsigned long clock = min(modeMaxClock, max(modeMinClock, idealClock))
 *         hzstr = str(vrefresh)
*/
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_idealVSync); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_xTotal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_yTotal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_yFactor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_idealClock = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "xpra/x11/bindings/randr.pyx":944
 * 
 *         idealClock = idealVSync * xTotal * yTotal * yFactor
 *         cdef unsigned long clock = min(modeMaxClock, max(modeMinClock, idealClock))             # <<<<<<<<<<<<<<
 *         hzstr = str(vrefresh)
 *         if hzstr.find(".") > 0:
*/
  __Pyx_INCREF(__pyx_v_idealClock);
  __pyx_t_5 = __pyx_v_idealClock;
  __Pyx_INCREF(__pyx_v_modeMinClock);
  __pyx_t_1 = __pyx_v_modeMinClock;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_modeMaxClock);
  __pyx_t_3 = __pyx_v_modeMaxClock;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_13 = __Pyx_PyLong_As_unsigned_long(__pyx_t_1); if (unlikely((__pyx_t_13 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_clock = __pyx_t_13;

  /* "xpra/x11/bindings/randr.pyx":945
 *         idealClock = idealVSync * xTotal * yTotal * yFactor
 *         cdef unsigned long clock = min(modeMaxClock, max(modeMinClock, idealClock))
 *         hzstr = str(vrefresh)             # <<<<<<<<<<<<<<
 *         if hzstr.find(".") > 0:
 *             hzstr = hzstr.rstrip("0").rstrip(".")
*/
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_vrefresh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hzstr = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "xpra/x11/bindings/randr.pyx":946
 *         cdef unsigned long clock = min(modeMaxClock, max(modeMinClock, idealClock))
 *         hzstr = str(vrefresh)
 *         if hzstr.find(".") > 0:             # <<<<<<<<<<<<<<
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         log("Modeline %ix%i@%s %s %s %s %s %s %s %s %s %s", w, h, hzstr,
*/
  __pyx_t_11 = PyUnicode_Find(__pyx_v_hzstr, __pyx_mstate_global->__pyx_kp_u__4, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-2))) __PYX_ERR(0, 946, __pyx_L1_error)
  __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "xpra/x11/bindings/randr.pyx":947
 *         hzstr = str(vrefresh)
 *         if hzstr.find(".") > 0:
 *             hzstr = hzstr.rstrip("0").rstrip(".")             # <<<<<<<<<<<<<<
 *         log("Modeline %ix%i@%s %s %s %s %s %s %s %s %s %s", w, h, hzstr,
 *                         clock/1000/1000,
*/
    __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__rstrip, __pyx_v_hzstr, __pyx_mstate_global->__pyx_kp_u_0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u__4};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_rstrip, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_hzstr, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":946
 *         cdef unsigned long clock = min(modeMaxClock, max(modeMinClock, idealClock))
 *         hzstr = str(vrefresh)
 *         if hzstr.find(".") > 0:             # <<<<<<<<<<<<<<
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         log("Modeline %ix%i@%s %s %s %s %s %s %s %s %s %s", w, h, hzstr,
*/
  }

  /* "xpra/x11/bindings/randr.pyx":948
 *         if hzstr.find(".") > 0:
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         log("Modeline %ix%i@%s %s %s %s %s %s %s %s %s %s", w, h, hzstr,             # <<<<<<<<<<<<<<
 *                         clock/1000/1000,
 *                         w, w+xFront, w+xFront+xSync, xTotal,
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "xpra/x11/bindings/randr.pyx":949
 *             hzstr = hzstr.rstrip("0").rstrip(".")
 *         log("Modeline %ix%i@%s %s %s %s %s %s %s %s %s %s", w, h, hzstr,
 *                         clock/1000/1000,             # <<<<<<<<<<<<<<
 *                         w, w+xFront, w+xFront+xSync, xTotal,
 *                         h, h+yFront, h+yFront+ySync, yTotal)
*/
  __pyx_t_4 = __Pyx_PyLong_From_unsigned_long(((__pyx_v_clock / 0x3E8) / 0x3E8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "xpra/x11/bindings/randr.pyx":950
 *         log("Modeline %ix%i@%s %s %s %s %s %s %s %s %s %s", w, h, hzstr,
 *                         clock/1000/1000,
 *                         w, w+xFront, w+xFront+xSync, xTotal,             # <<<<<<<<<<<<<<
 *                         h, h+yFront, h+yFront+ySync, yTotal)
 *         mode.width = w
*/
  __pyx_t_14 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyNumber_Add(__pyx_t_15, __pyx_v_xFront); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_17 = PyNumber_Add(__pyx_t_15, __pyx_v_xFront); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = PyNumber_Add(__pyx_t_17, __pyx_v_xSync); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "xpra/x11/bindings/randr.pyx":951
 *                         clock/1000/1000,
 *                         w, w+xFront, w+xFront+xSync, xTotal,
 *                         h, h+yFront, h+yFront+ySync, yTotal)             # <<<<<<<<<<<<<<
 *         mode.width = w
 *         mode.height = h
*/
  __pyx_t_17 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_18 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_19 = PyNumber_Add(__pyx_t_18, __pyx_v_yFront); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_18 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_20 = PyNumber_Add(__pyx_t_18, __pyx_v_yFront); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_18 = PyNumber_Add(__pyx_t_20, __pyx_v_ySync); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[14] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Modeline_ix_i_s_s_s_s_s_s_s_s_s, __pyx_t_2, __pyx_t_6, __pyx_v_hzstr, __pyx_t_4, __pyx_t_14, __pyx_t_16, __pyx_t_15, __pyx_v_xTotal, __pyx_t_17, __pyx_t_19, __pyx_t_18, __pyx_v_yTotal};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (14-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":952
 *                         w, w+xFront, w+xFront+xSync, xTotal,
 *                         h, h+yFront, h+yFront+ySync, yTotal)
 *         mode.width = w             # <<<<<<<<<<<<<<
 *         mode.height = h
 *         mode.dotClock = clock
*/
  __pyx_v_mode->width = __pyx_v_w;

  /* "xpra/x11/bindings/randr.pyx":953
 *                         h, h+yFront, h+yFront+ySync, yTotal)
 *         mode.width = w
 *         mode.height = h             # <<<<<<<<<<<<<<
 *         mode.dotClock = clock
 *         mode.hSyncStart = round(w+xFront)
*/
  __pyx_v_mode->height = __pyx_v_h;

  /* "xpra/x11/bindings/randr.pyx":954
 *         mode.width = w
 *         mode.height = h
 *         mode.dotClock = clock             # <<<<<<<<<<<<<<
 *         mode.hSyncStart = round(w+xFront)
 *         mode.hSyncEnd = round(w+xFront+xSync)
*/
  __pyx_v_mode->dotClock = __pyx_v_clock;

  /* "xpra/x11/bindings/randr.pyx":955
 *         mode.height = h
 *         mode.dotClock = clock
 *         mode.hSyncStart = round(w+xFront)             # <<<<<<<<<<<<<<
 *         mode.hSyncEnd = round(w+xFront+xSync)
 *         mode.hTotal = round(xTotal)
*/
  __pyx_t_5 = NULL;
  __pyx_t_18 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_19 = PyNumber_Add(__pyx_t_18, __pyx_v_xFront); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_19};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_21 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mode->hSyncStart = __pyx_t_21;

  /* "xpra/x11/bindings/randr.pyx":956
 *         mode.dotClock = clock
 *         mode.hSyncStart = round(w+xFront)
 *         mode.hSyncEnd = round(w+xFront+xSync)             # <<<<<<<<<<<<<<
 *         mode.hTotal = round(xTotal)
 *         mode.hSkew = 0
*/
  __pyx_t_19 = NULL;
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_18 = PyNumber_Add(__pyx_t_5, __pyx_v_xFront); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_18, __pyx_v_xSync); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_19, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_21 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mode->hSyncEnd = __pyx_t_21;

  /* "xpra/x11/bindings/randr.pyx":957
 *         mode.hSyncStart = round(w+xFront)
 *         mode.hSyncEnd = round(w+xFront+xSync)
 *         mode.hTotal = round(xTotal)             # <<<<<<<<<<<<<<
 *         mode.hSkew = 0
 *         mode.vSyncStart = round(h+yFront)
*/
  __pyx_t_5 = NULL;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_xTotal};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_21 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mode->hTotal = __pyx_t_21;

  /* "xpra/x11/bindings/randr.pyx":958
 *         mode.hSyncEnd = round(w+xFront+xSync)
 *         mode.hTotal = round(xTotal)
 *         mode.hSkew = 0             # <<<<<<<<<<<<<<
 *         mode.vSyncStart = round(h+yFront)
 *         mode.vSyncEnd = round(h+yFront+ySync)
*/
  __pyx_v_mode->hSkew = 0;

  /* "xpra/x11/bindings/randr.pyx":959
 *         mode.hTotal = round(xTotal)
 *         mode.hSkew = 0
 *         mode.vSyncStart = round(h+yFront)             # <<<<<<<<<<<<<<
 *         mode.vSyncEnd = round(h+yFront+ySync)
 *         mode.vTotal = round(yTotal)
*/
  __pyx_t_5 = NULL;
  __pyx_t_19 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_18 = PyNumber_Add(__pyx_t_19, __pyx_v_yFront); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_18};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_21 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mode->vSyncStart = __pyx_t_21;

  /* "xpra/x11/bindings/randr.pyx":960
 *         mode.hSkew = 0
 *         mode.vSyncStart = round(h+yFront)
 *         mode.vSyncEnd = round(h+yFront+ySync)             # <<<<<<<<<<<<<<
 *         mode.vTotal = round(yTotal)
 *         mode.modeFlags = 0
*/
  __pyx_t_18 = NULL;
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_19 = PyNumber_Add(__pyx_t_5, __pyx_v_yFront); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_19, __pyx_v_ySync); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_21 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mode->vSyncEnd = __pyx_t_21;

  /* "xpra/x11/bindings/randr.pyx":961
 *         mode.vSyncStart = round(h+yFront)
 *         mode.vSyncEnd = round(h+yFront+ySync)
 *         mode.vTotal = round(yTotal)             # <<<<<<<<<<<<<<
 *         mode.modeFlags = 0
 *         return mode
*/
  __pyx_t_5 = NULL;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_yTotal};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_21 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 961, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mode->vTotal = __pyx_t_21;

  /* "xpra/x11/bindings/randr.pyx":962
 *         mode.vSyncEnd = round(h+yFront+ySync)
 *         mode.vTotal = round(yTotal)
 *         mode.modeFlags = 0             # <<<<<<<<<<<<<<
 *         return mode
 * 
*/
  __pyx_v_mode->modeFlags = 0;

  /* "xpra/x11/bindings/randr.pyx":963
 *         mode.vTotal = round(yTotal)
 *         mode.modeFlags = 0
 *         return mode             # <<<<<<<<<<<<<<
 * 
 *     def remove_screen_size(self, unsigned int w, unsigned int h) -> None:
*/
  __pyx_r = __pyx_v_mode;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":901
 *         return mode
 * 
 *     cdef XRRModeInfo *calculate_mode(self, name, unsigned int w, unsigned int h, double vrefresh) noexcept:             # <<<<<<<<<<<<<<
 *         log("calculate_mode(%s, %i, %i, %f)", name, w, h, vrefresh)
 *         if vrefresh <= 0 or vrefresh > 500:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_WriteUnraisable("xpra.x11.bindings.randr.RandRBindingsInstance.calculate_mode", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bname);
  __Pyx_XDECREF(__pyx_v_xFront);
  __Pyx_XDECREF(__pyx_v_xSync);
  __Pyx_XDECREF(__pyx_v_xBack);
  __Pyx_XDECREF(__pyx_v_xTotal);
  __Pyx_XDECREF(__pyx_v_yFront);
  __Pyx_XDECREF(__pyx_v_ySync);
  __Pyx_XDECREF(__pyx_v_yBack);
  __Pyx_XDECREF(__pyx_v_yTotal);
  __Pyx_XDECREF(__pyx_v_maxPixelClock);
  __Pyx_XDECREF(__pyx_v_modeMaxClock);
  __Pyx_XDECREF(__pyx_v_modeMinClock);
  __Pyx_XDECREF(__pyx_v_idealClock);
  __Pyx_XDECREF(__pyx_v_hzstr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":965
 *         return mode
 * 
 *     def remove_screen_size(self, unsigned int w, unsigned int h) -> None:             # <<<<<<<<<<<<<<
 *         #TODO: instead of keeping the mode ID,
 *         #we should query the output and find the mode dynamically...
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_39remove_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_39remove_screen_size = {"remove_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_39remove_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_39remove_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  unsigned int __pyx_v_w;
  unsigned int __pyx_v_h;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_screen_size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_w,&__pyx_mstate_global->__pyx_n_u_h,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 965, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 965, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 965, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "remove_screen_size", 0) < (0)) __PYX_ERR(0, 965, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("remove_screen_size", 1, 2, 2, i); __PYX_ERR(0, 965, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 965, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 965, __pyx_L3_error)
    }
    __pyx_v_w = __Pyx_PyLong_As_unsigned_int(values[0]); if (unlikely((__pyx_v_w == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 965, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyLong_As_unsigned_int(values[1]); if (unlikely((__pyx_v_h == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 965, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove_screen_size", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 965, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.remove_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_38remove_screen_size(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), __pyx_v_w, __pyx_v_h);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_38remove_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, unsigned int __pyx_v_w, unsigned int __pyx_v_h) {
  PyObject *__pyx_v_name = NULL;
  RRMode __pyx_v_mode;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3[3];
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  RRMode __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove_screen_size", 0);

  /* "xpra/x11/bindings/randr.pyx":968
 *         #TODO: instead of keeping the mode ID,
 *         #we should query the output and find the mode dynamically...
 *         name = "%sx%s" % (w, h)             # <<<<<<<<<<<<<<
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode and self.remove_mode(mode):
*/
  __pyx_t_1 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_w, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_h, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3[0] = __pyx_t_1;
  __pyx_t_3[1] = __pyx_mstate_global->__pyx_n_u_x;
  __pyx_t_3[2] = __pyx_t_2;
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127);
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_name = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":969
 *         #we should query the output and find the mode dynamically...
 *         name = "%sx%s" % (w, h)
 *         cdef RRMode mode = self._added_modes.get(name, 0)             # <<<<<<<<<<<<<<
 *         if mode and self.remove_mode(mode):
 *             del self._added_modes[name]
*/
  __pyx_t_2 = __pyx_v_self->_added_modes;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_name, __pyx_mstate_global->__pyx_int_0};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_6 = __Pyx_PyLong_As_unsigned_long(__pyx_t_4); if (unlikely((__pyx_t_6 == ((RRMode)-1)) && PyErr_Occurred())) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_mode = __pyx_t_6;

  /* "xpra/x11/bindings/randr.pyx":970
 *         name = "%sx%s" % (w, h)
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode and self.remove_mode(mode):             # <<<<<<<<<<<<<<
 *             del self._added_modes[name]
 * 
*/
  __pyx_t_8 = (__pyx_v_mode != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_remove_mode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 970, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_7) {

    /* "xpra/x11/bindings/randr.pyx":971
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode and self.remove_mode(mode):
 *             del self._added_modes[name]             # <<<<<<<<<<<<<<
 * 
 *     def remove_mode(self, RRMode mode) -> None:
*/
    if (unlikely((PyObject_DelItem(__pyx_v_self->_added_modes, __pyx_v_name) < 0))) __PYX_ERR(0, 971, __pyx_L1_error)

    /* "xpra/x11/bindings/randr.pyx":970
 *         name = "%sx%s" % (w, h)
 *         cdef RRMode mode = self._added_modes.get(name, 0)
 *         if mode and self.remove_mode(mode):             # <<<<<<<<<<<<<<
 *             del self._added_modes[name]
 * 
*/
  }

  /* "xpra/x11/bindings/randr.pyx":965
 *         return mode
 * 
 *     def remove_screen_size(self, unsigned int w, unsigned int h) -> None:             # <<<<<<<<<<<<<<
 *         #TODO: instead of keeping the mode ID,
 *         #we should query the output and find the mode dynamically...
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.remove_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":973
 *             del self._added_modes[name]
 * 
 *     def remove_mode(self, RRMode mode) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("remove_mode")
 *         cdef RROutput output = self.get_current_output()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_41remove_mode(PyObject *__pyx_v_self, PyObject *__pyx_arg_mode); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_41remove_mode = {"remove_mode", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_41remove_mode, METH_O, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_41remove_mode(PyObject *__pyx_v_self, PyObject *__pyx_arg_mode) {
  RRMode __pyx_v_mode;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_mode (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  assert(__pyx_arg_mode); {
    __pyx_v_mode = __Pyx_PyLong_As_unsigned_long(__pyx_arg_mode); if (unlikely((__pyx_v_mode == ((RRMode)-1)) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.remove_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_40remove_mode(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), ((RRMode)__pyx_v_mode));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_40remove_mode(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, RRMode __pyx_v_mode) {
  RROutput __pyx_v_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  RROutput __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[4];
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove_mode", 0);

  /* "xpra/x11/bindings/randr.pyx":974
 * 
 *     def remove_mode(self, RRMode mode) -> None:
 *         self.context_check("remove_mode")             # <<<<<<<<<<<<<<
 *         cdef RROutput output = self.get_current_output()
 *         log(f"remove_mode({mode}) output={output}")
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_remove_mode};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":975
 *     def remove_mode(self, RRMode mode) -> None:
 *         self.context_check("remove_mode")
 *         cdef RROutput output = self.get_current_output()             # <<<<<<<<<<<<<<
 *         log(f"remove_mode({mode}) output={output}")
 *         if mode and output:
*/
  __pyx_t_4 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_current_output(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 975, __pyx_L1_error)
  __pyx_v_output = __pyx_t_4;

  /* "xpra/x11/bindings/randr.pyx":976
 *         self.context_check("remove_mode")
 *         cdef RROutput output = self.get_current_output()
 *         log(f"remove_mode({mode}) output={output}")             # <<<<<<<<<<<<<<
 *         if mode and output:
 *             XRRDeleteOutputMode(self.display, output, mode)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyUnicode_From_RRMode(__pyx_v_mode, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyUnicode_From_RROutput(__pyx_v_output, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_remove_mode_2;
  __pyx_t_8[1] = __pyx_t_6;
  __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_output;
  __pyx_t_8[3] = __pyx_t_7;
  __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7), 127);
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":977
 *         cdef RROutput output = self.get_current_output()
 *         log(f"remove_mode({mode}) output={output}")
 *         if mode and output:             # <<<<<<<<<<<<<<
 *             XRRDeleteOutputMode(self.display, output, mode)
 *             XRRDestroyMode(self.display, mode)
*/
  __pyx_t_11 = (__pyx_v_mode != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_10 = __pyx_t_11;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_output != 0);
  __pyx_t_10 = __pyx_t_11;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_10) {

    /* "xpra/x11/bindings/randr.pyx":978
 *         log(f"remove_mode({mode}) output={output}")
 *         if mode and output:
 *             XRRDeleteOutputMode(self.display, output, mode)             # <<<<<<<<<<<<<<
 *             XRRDestroyMode(self.display, mode)
 * 
*/
    XRRDeleteOutputMode(__pyx_v_self->__pyx_base.display, __pyx_v_output, __pyx_v_mode);

    /* "xpra/x11/bindings/randr.pyx":979
 *         if mode and output:
 *             XRRDeleteOutputMode(self.display, output, mode)
 *             XRRDestroyMode(self.display, mode)             # <<<<<<<<<<<<<<
 * 
 *     cdef RROutput get_current_output(self):
*/
    XRRDestroyMode(__pyx_v_self->__pyx_base.display, __pyx_v_mode);

    /* "xpra/x11/bindings/randr.pyx":977
 *         cdef RROutput output = self.get_current_output()
 *         log(f"remove_mode({mode}) output={output}")
 *         if mode and output:             # <<<<<<<<<<<<<<
 *             XRRDeleteOutputMode(self.display, output, mode)
 *             XRRDestroyMode(self.display, mode)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":973
 *             del self._added_modes[name]
 * 
 *     def remove_mode(self, RRMode mode) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("remove_mode")
 *         cdef RROutput output = self.get_current_output()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.remove_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":981
 *             XRRDestroyMode(self.display, mode)
 * 
 *     cdef RROutput get_current_output(self):             # <<<<<<<<<<<<<<
 *         self.context_check("get_current_output")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

static RROutput __pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_get_current_output(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenResources *__pyx_v_rsc;
  RROutput __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  RROutput __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_current_output", 0);

  /* "xpra/x11/bindings/randr.pyx":982
 * 
 *     cdef RROutput get_current_output(self):
 *         self.context_check("get_current_output")             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_current_output};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":983
 *     cdef RROutput get_current_output(self):
 *         self.context_check("get_current_output")
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         assert rsc!=NULL
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":984
 *         self.context_check("get_current_output")
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)             # <<<<<<<<<<<<<<
 *         assert rsc!=NULL
 *         try:
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":985
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         assert rsc!=NULL             # <<<<<<<<<<<<<<
 *         try:
 *             log("get_current_output() screen_resources: crtcs=%s, outputs=%s, modes=%s", rsc.ncrtc, rsc.noutput, rsc.nmode)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_4 = (__pyx_v_rsc != NULL);
    if (unlikely(!__pyx_t_4)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 985, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 985, __pyx_L1_error)
  #endif

  /* "xpra/x11/bindings/randr.pyx":986
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         assert rsc!=NULL
 *         try:             # <<<<<<<<<<<<<<
 *             log("get_current_output() screen_resources: crtcs=%s, outputs=%s, modes=%s", rsc.ncrtc, rsc.noutput, rsc.nmode)
 *             if rsc.noutput==0:
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":987
 *         assert rsc!=NULL
 *         try:
 *             log("get_current_output() screen_resources: crtcs=%s, outputs=%s, modes=%s", rsc.ncrtc, rsc.noutput, rsc.nmode)             # <<<<<<<<<<<<<<
 *             if rsc.noutput==0:
 *                 log.error("Error: this display has no outputs")
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 987, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_rsc->ncrtc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 987, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_rsc->noutput); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 987, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_rsc->nmode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 987, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_get_current_output_screen_resour, __pyx_t_6, __pyx_t_7, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (5-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 987, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":988
 *         try:
 *             log("get_current_output() screen_resources: crtcs=%s, outputs=%s, modes=%s", rsc.ncrtc, rsc.noutput, rsc.nmode)
 *             if rsc.noutput==0:             # <<<<<<<<<<<<<<
 *                 log.error("Error: this display has no outputs")
 *                 return 0
*/
    __pyx_t_4 = (__pyx_v_rsc->noutput == 0);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":989
 *             log("get_current_output() screen_resources: crtcs=%s, outputs=%s, modes=%s", rsc.ncrtc, rsc.noutput, rsc.nmode)
 *             if rsc.noutput==0:
 *                 log.error("Error: this display has no outputs")             # <<<<<<<<<<<<<<
 *                 return 0
 *             if rsc.noutput>1:
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 989, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 989, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_this_display_has_no_output};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":990
 *             if rsc.noutput==0:
 *                 log.error("Error: this display has no outputs")
 *                 return 0             # <<<<<<<<<<<<<<
 *             if rsc.noutput>1:
 *                 log(f"{rsc.noutput} outputs")
*/
      __pyx_r = 0;
      goto __pyx_L3_return;

      /* "xpra/x11/bindings/randr.pyx":988
 *         try:
 *             log("get_current_output() screen_resources: crtcs=%s, outputs=%s, modes=%s", rsc.ncrtc, rsc.noutput, rsc.nmode)
 *             if rsc.noutput==0:             # <<<<<<<<<<<<<<
 *                 log.error("Error: this display has no outputs")
 *                 return 0
*/
    }

    /* "xpra/x11/bindings/randr.pyx":991
 *                 log.error("Error: this display has no outputs")
 *                 return 0
 *             if rsc.noutput>1:             # <<<<<<<<<<<<<<
 *                 log(f"{rsc.noutput} outputs")
 *             return rsc.outputs[0]
*/
    __pyx_t_4 = (__pyx_v_rsc->noutput > 1);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":992
 *                 return 0
 *             if rsc.noutput>1:
 *                 log(f"{rsc.noutput} outputs")             # <<<<<<<<<<<<<<
 *             return rsc.outputs[0]
 *         finally:
*/
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 992, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_rsc->noutput, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 992, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_outputs_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 992, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 992, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":991
 *                 log.error("Error: this display has no outputs")
 *                 return 0
 *             if rsc.noutput>1:             # <<<<<<<<<<<<<<
 *                 log(f"{rsc.noutput} outputs")
 *             return rsc.outputs[0]
*/
    }

    /* "xpra/x11/bindings/randr.pyx":993
 *             if rsc.noutput>1:
 *                 log(f"{rsc.noutput} outputs")
 *             return rsc.outputs[0]             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenResources(rsc)
*/
    __pyx_r = (__pyx_v_rsc->outputs[0]);
    goto __pyx_L3_return;
  }

  /* "xpra/x11/bindings/randr.pyx":995
 *             return rsc.outputs[0]
 *         finally:
 *             XRRFreeScreenResources(rsc)             # <<<<<<<<<<<<<<
 * 
 *     def xrr_set_screen_size(self, int w, int h, int wmm, int hmm) -> None:
*/
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        XRRFreeScreenResources(__pyx_v_rsc);
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_18 = __pyx_r;
      XRRFreeScreenResources(__pyx_v_rsc);
      __pyx_r = __pyx_t_18;
      goto __pyx_L0;
    }
  }

  /* "xpra/x11/bindings/randr.pyx":981
 *             XRRDestroyMode(self.display, mode)
 * 
 *     cdef RROutput get_current_output(self):             # <<<<<<<<<<<<<<
 *         self.context_check("get_current_output")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_current_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":997
 *             XRRFreeScreenResources(rsc)
 * 
 *     def xrr_set_screen_size(self, int w, int h, int wmm, int hmm) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("xrr_set_screen_size")
 *         #and now use it:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_43xrr_set_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_43xrr_set_screen_size = {"xrr_set_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_43xrr_set_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_43xrr_set_screen_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_w;
  int __pyx_v_h;
  int __pyx_v_wmm;
  int __pyx_v_hmm;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xrr_set_screen_size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_w,&__pyx_mstate_global->__pyx_n_u_h,&__pyx_mstate_global->__pyx_n_u_wmm,&__pyx_mstate_global->__pyx_n_u_hmm,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 997, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 997, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 997, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 997, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 997, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "xrr_set_screen_size", 0) < (0)) __PYX_ERR(0, 997, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("xrr_set_screen_size", 1, 4, 4, i); __PYX_ERR(0, 997, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 997, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 997, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 997, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 997, __pyx_L3_error)
    }
    __pyx_v_w = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L3_error)
    __pyx_v_wmm = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_wmm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L3_error)
    __pyx_v_hmm = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_hmm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xrr_set_screen_size", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 997, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.xrr_set_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_42xrr_set_screen_size(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), __pyx_v_w, __pyx_v_h, __pyx_v_wmm, __pyx_v_hmm);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_42xrr_set_screen_size(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, int __pyx_v_w, int __pyx_v_h, int __pyx_v_wmm, int __pyx_v_hmm) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xrr_set_screen_size", 0);

  /* "xpra/x11/bindings/randr.pyx":998
 * 
 *     def xrr_set_screen_size(self, int w, int h, int wmm, int hmm) -> None:
 *         self.context_check("xrr_set_screen_size")             # <<<<<<<<<<<<<<
 *         #and now use it:
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_xrr_set_screen_size};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1000
 *         self.context_check("xrr_set_screen_size")
 *         #and now use it:
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         log("XRRSetScreenSize(%#x, %#x, %i, %i, %i, %i)", <uintptr_t> self.display, window, w, h, wmm, hmm)
 *         XRRSetScreenSize(self.display, window, w, h, wmm, hmm)
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":1001
 *         #and now use it:
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         log("XRRSetScreenSize(%#x, %#x, %i, %i, %i, %i)", <uintptr_t> self.display, window, w, h, wmm, hmm)             # <<<<<<<<<<<<<<
 *         XRRSetScreenSize(self.display, window, w, h, wmm, hmm)
 *         self.XSync()
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_self->__pyx_base.display)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_long(__pyx_v_window); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_w); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_h); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_wmm); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyLong_From_int(__pyx_v_hmm); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[8] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_XRRSetScreenSize_x_x_i_i_i_i, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (8-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1001, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1002
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         log("XRRSetScreenSize(%#x, %#x, %i, %i, %i, %i)", <uintptr_t> self.display, window, w, h, wmm, hmm)
 *         XRRSetScreenSize(self.display, window, w, h, wmm, hmm)             # <<<<<<<<<<<<<<
 *         self.XSync()
 * 
*/
  XRRSetScreenSize(__pyx_v_self->__pyx_base.display, __pyx_v_window, __pyx_v_w, __pyx_v_h, __pyx_v_wmm, __pyx_v_hmm);

  /* "xpra/x11/bindings/randr.pyx":1003
 *         log("XRRSetScreenSize(%#x, %#x, %i, %i, %i, %i)", <uintptr_t> self.display, window, w, h, wmm, hmm)
 *         XRRSetScreenSize(self.display, window, w, h, wmm, hmm)
 *         self.XSync()             # <<<<<<<<<<<<<<
 * 
 * ################################################################
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_XSync, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":997
 *             XRRFreeScreenResources(rsc)
 * 
 *     def xrr_set_screen_size(self, int w, int h, int wmm, int hmm) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("xrr_set_screen_size")
 *         #and now use it:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.xrr_set_screen_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1010
 * ################################################################
 * 
 *     def is_dummy16(self) -> bool:             # <<<<<<<<<<<<<<
 *         self.context_check("is_dummy16")
 *         #figure out if we're dealing with the dummy with randr 1.6 support
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_45is_dummy16(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_45is_dummy16 = {"is_dummy16", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_45is_dummy16, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_45is_dummy16(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_dummy16 (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_44is_dummy16(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_44is_dummy16(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenResources *__pyx_v_rsc;
  int __pyx_v_nmonitors;
  XRRMonitorInfo *__pyx_v_monitors;
  int __pyx_v_i;
  int __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[3];
  int __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  int __pyx_t_19;
  PyObject *__pyx_t_20[5];
  PyObject *__pyx_t_21 = NULL;
  char const *__pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_dummy16", 0);

  /* "xpra/x11/bindings/randr.pyx":1011
 * 
 *     def is_dummy16(self) -> bool:
 *         self.context_check("is_dummy16")             # <<<<<<<<<<<<<<
 *         #figure out if we're dealing with the dummy with randr 1.6 support
 *         if not self._has_randr:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_is_dummy16};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1013
 *         self.context_check("is_dummy16")
 *         #figure out if we're dealing with the dummy with randr 1.6 support
 *         if not self._has_randr:             # <<<<<<<<<<<<<<
 *             log("is_dummy16() no randr!")
 *             return False
*/
  __pyx_t_4 = (!(__pyx_v_self->_has_randr != 0));
  if (__pyx_t_4) {

    /* "xpra/x11/bindings/randr.pyx":1014
 *         #figure out if we're dealing with the dummy with randr 1.6 support
 *         if not self._has_randr:
 *             log("is_dummy16() no randr!")             # <<<<<<<<<<<<<<
 *             return False
 *         if self.version<(1, 6):
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_is_dummy16_no_randr};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1015
 *         if not self._has_randr:
 *             log("is_dummy16() no randr!")
 *             return False             # <<<<<<<<<<<<<<
 *         if self.version<(1, 6):
 *             log(f"is_dummy16() randr version too old: {self.version}")
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1013
 *         self.context_check("is_dummy16")
 *         #figure out if we're dealing with the dummy with randr 1.6 support
 *         if not self._has_randr:             # <<<<<<<<<<<<<<
 *             log("is_dummy16() no randr!")
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1016
 *             log("is_dummy16() no randr!")
 *             return False
 *         if self.version<(1, 6):             # <<<<<<<<<<<<<<
 *             log(f"is_dummy16() randr version too old: {self.version}")
 *             return False
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->version, __pyx_mstate_global->__pyx_tuple[3], Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1016, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "xpra/x11/bindings/randr.pyx":1017
 *             return False
 *         if self.version<(1, 6):
 *             log(f"is_dummy16() randr version too old: {self.version}")             # <<<<<<<<<<<<<<
 *             return False
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_self->version, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_is_dummy16_randr_version_too_old, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1018
 *         if self.version<(1, 6):
 *             log(f"is_dummy16() randr version too old: {self.version}")
 *             return False             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1016
 *             log("is_dummy16() no randr!")
 *             return False
 *         if self.version<(1, 6):             # <<<<<<<<<<<<<<
 *             log(f"is_dummy16() randr version too old: {self.version}")
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1019
 *             log(f"is_dummy16() randr version too old: {self.version}")
 *             return False
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         try:
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":1020
 *             return False
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)             # <<<<<<<<<<<<<<
 *         try:
 *             if rsc.ncrtc<16:
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":1021
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         try:             # <<<<<<<<<<<<<<
 *             if rsc.ncrtc<16:
 *                 log(f"is_dummy16() only {rsc.ncrtc} crtcs")
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":1022
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         try:
 *             if rsc.ncrtc<16:             # <<<<<<<<<<<<<<
 *                 log(f"is_dummy16() only {rsc.ncrtc} crtcs")
 *                 return False
*/
    __pyx_t_4 = (__pyx_v_rsc->ncrtc < 16);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":1023
 *         try:
 *             if rsc.ncrtc<16:
 *                 log(f"is_dummy16() only {rsc.ncrtc} crtcs")             # <<<<<<<<<<<<<<
 *                 return False
 *             if rsc.noutput<16:
*/
      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1023, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_rsc->ncrtc, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1023, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_is_dummy16_only;
      __pyx_t_8[1] = __pyx_t_5;
      __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_crtcs_2;
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 6, 127);
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1023, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1023, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1024
 *             if rsc.ncrtc<16:
 *                 log(f"is_dummy16() only {rsc.ncrtc} crtcs")
 *                 return False             # <<<<<<<<<<<<<<
 *             if rsc.noutput<16:
 *                 log(f"is_dummy16() only {rsc.noutput} outputs")
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L5_return;

      /* "xpra/x11/bindings/randr.pyx":1022
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         try:
 *             if rsc.ncrtc<16:             # <<<<<<<<<<<<<<
 *                 log(f"is_dummy16() only {rsc.ncrtc} crtcs")
 *                 return False
*/
    }

    /* "xpra/x11/bindings/randr.pyx":1025
 *                 log(f"is_dummy16() only {rsc.ncrtc} crtcs")
 *                 return False
 *             if rsc.noutput<16:             # <<<<<<<<<<<<<<
 *                 log(f"is_dummy16() only {rsc.noutput} outputs")
 *                 return False
*/
    __pyx_t_4 = (__pyx_v_rsc->noutput < 16);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":1026
 *                 return False
 *             if rsc.noutput<16:
 *                 log(f"is_dummy16() only {rsc.noutput} outputs")             # <<<<<<<<<<<<<<
 *                 return False
 *             if rsc.nmode==0:
*/
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1026, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_rsc->noutput, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_is_dummy16_only;
      __pyx_t_8[1] = __pyx_t_2;
      __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_outputs_2;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1027
 *             if rsc.noutput<16:
 *                 log(f"is_dummy16() only {rsc.noutput} outputs")
 *                 return False             # <<<<<<<<<<<<<<
 *             if rsc.nmode==0:
 *                 log("is_dummy16() no modes!")
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L5_return;

      /* "xpra/x11/bindings/randr.pyx":1025
 *                 log(f"is_dummy16() only {rsc.ncrtc} crtcs")
 *                 return False
 *             if rsc.noutput<16:             # <<<<<<<<<<<<<<
 *                 log(f"is_dummy16() only {rsc.noutput} outputs")
 *                 return False
*/
    }

    /* "xpra/x11/bindings/randr.pyx":1028
 *                 log(f"is_dummy16() only {rsc.noutput} outputs")
 *                 return False
 *             if rsc.nmode==0:             # <<<<<<<<<<<<<<
 *                 log("is_dummy16() no modes!")
 *                 return False
*/
    __pyx_t_4 = (__pyx_v_rsc->nmode == 0);
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":1029
 *                 return False
 *             if rsc.nmode==0:
 *                 log("is_dummy16() no modes!")             # <<<<<<<<<<<<<<
 *                 return False
 *         finally:
*/
      __pyx_t_6 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1029, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_6);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_is_dummy16_no_modes};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1030
 *             if rsc.nmode==0:
 *                 log("is_dummy16() no modes!")
 *                 return False             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenResources(rsc)
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L5_return;

      /* "xpra/x11/bindings/randr.pyx":1028
 *                 log(f"is_dummy16() only {rsc.noutput} outputs")
 *                 return False
 *             if rsc.nmode==0:             # <<<<<<<<<<<<<<
 *                 log("is_dummy16() no modes!")
 *                 return False
*/
    }
  }

  /* "xpra/x11/bindings/randr.pyx":1032
 *                 return False
 *         finally:
 *             XRRFreeScreenResources(rsc)             # <<<<<<<<<<<<<<
 *         cdef int nmonitors
 *         cdef XRRMonitorInfo *monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
*/
  /*finally:*/ {
    /*normal exit:*/{
      XRRFreeScreenResources(__pyx_v_rsc);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        XRRFreeScreenResources(__pyx_v_rsc);
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L5_return: {
      __pyx_t_17 = __pyx_r;
      __pyx_r = 0;
      XRRFreeScreenResources(__pyx_v_rsc);
      __pyx_r = __pyx_t_17;
      __pyx_t_17 = 0;
      goto __pyx_L0;
    }
    __pyx_L7:;
  }

  /* "xpra/x11/bindings/randr.pyx":1034
 *             XRRFreeScreenResources(rsc)
 *         cdef int nmonitors
 *         cdef XRRMonitorInfo *monitors = XRRGetMonitors(self.display, window, True, &nmonitors)             # <<<<<<<<<<<<<<
 *         try:
 *             if not nmonitors:
*/
  __pyx_v_monitors = XRRGetMonitors(__pyx_v_self->__pyx_base.display, __pyx_v_window, 1, (&__pyx_v_nmonitors));

  /* "xpra/x11/bindings/randr.pyx":1035
 *         cdef int nmonitors
 *         cdef XRRMonitorInfo *monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *         try:             # <<<<<<<<<<<<<<
 *             if not nmonitors:
 *                 log("is_dummy16() no monitors!")
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":1036
 *         cdef XRRMonitorInfo *monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *         try:
 *             if not nmonitors:             # <<<<<<<<<<<<<<
 *                 log("is_dummy16() no monitors!")
 *                 return False
*/
    __pyx_t_4 = (!(__pyx_v_nmonitors != 0));
    if (__pyx_t_4) {

      /* "xpra/x11/bindings/randr.pyx":1037
 *         try:
 *             if not nmonitors:
 *                 log("is_dummy16() no monitors!")             # <<<<<<<<<<<<<<
 *                 return False
 *             for i in range(nmonitors):
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_is_dummy16_no_monitors};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1037, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1038
 *             if not nmonitors:
 *                 log("is_dummy16() no monitors!")
 *                 return False             # <<<<<<<<<<<<<<
 *             for i in range(nmonitors):
 *                 if monitors[i].noutput!=1:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L13_return;

      /* "xpra/x11/bindings/randr.pyx":1036
 *         cdef XRRMonitorInfo *monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *         try:
 *             if not nmonitors:             # <<<<<<<<<<<<<<
 *                 log("is_dummy16() no monitors!")
 *                 return False
*/
    }

    /* "xpra/x11/bindings/randr.pyx":1039
 *                 log("is_dummy16() no monitors!")
 *                 return False
 *             for i in range(nmonitors):             # <<<<<<<<<<<<<<
 *                 if monitors[i].noutput!=1:
 *                     n = monitors[i].noutput
*/
    __pyx_t_10 = __pyx_v_nmonitors;
    __pyx_t_9 = __pyx_t_10;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_9; __pyx_t_18+=1) {
      __pyx_v_i = __pyx_t_18;

      /* "xpra/x11/bindings/randr.pyx":1040
 *                 return False
 *             for i in range(nmonitors):
 *                 if monitors[i].noutput!=1:             # <<<<<<<<<<<<<<
 *                     n = monitors[i].noutput
 *                     log(f"is_dummy16() monitor {i} has {n} outputs")
*/
      __pyx_t_4 = ((__pyx_v_monitors[__pyx_v_i]).noutput != 1);
      if (__pyx_t_4) {

        /* "xpra/x11/bindings/randr.pyx":1041
 *             for i in range(nmonitors):
 *                 if monitors[i].noutput!=1:
 *                     n = monitors[i].noutput             # <<<<<<<<<<<<<<
 *                     log(f"is_dummy16() monitor {i} has {n} outputs")
 *                     return False
*/
        __pyx_t_19 = (__pyx_v_monitors[__pyx_v_i]).noutput;
        __pyx_v_n = __pyx_t_19;

        /* "xpra/x11/bindings/randr.pyx":1042
 *                 if monitors[i].noutput!=1:
 *                     n = monitors[i].noutput
 *                     log(f"is_dummy16() monitor {i} has {n} outputs")             # <<<<<<<<<<<<<<
 *                     return False
 *         finally:
*/
        __pyx_t_6 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1042, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1042, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_n, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1042, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u_is_dummy16_monitor;
        __pyx_t_20[1] = __pyx_t_7;
        __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u_has;
        __pyx_t_20[3] = __pyx_t_2;
        __pyx_t_20[4] = __pyx_mstate_global->__pyx_kp_u_outputs_2;
        __pyx_t_21 = __Pyx_PyUnicode_Join(__pyx_t_20, 5, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127);
        if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1042, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_21);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_6);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_21};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1042, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":1043
 *                     n = monitors[i].noutput
 *                     log(f"is_dummy16() monitor {i} has {n} outputs")
 *                     return False             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeMonitors(monitors)
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L13_return;

        /* "xpra/x11/bindings/randr.pyx":1040
 *                 return False
 *             for i in range(nmonitors):
 *                 if monitors[i].noutput!=1:             # <<<<<<<<<<<<<<
 *                     n = monitors[i].noutput
 *                     log(f"is_dummy16() monitor {i} has {n} outputs")
*/
      }
    }
  }

  /* "xpra/x11/bindings/randr.pyx":1045
 *                     return False
 *         finally:
 *             XRRFreeMonitors(monitors)             # <<<<<<<<<<<<<<
 *         return True
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      XRRFreeMonitors(__pyx_v_monitors);
      goto __pyx_L15;
    }
    __pyx_L14_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_10 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
      {
        XRRFreeMonitors(__pyx_v_monitors);
      }
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_13, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ErrRestore(__pyx_t_17, __pyx_t_16, __pyx_t_15);
      __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_22;
      goto __pyx_L1_error;
    }
    __pyx_L13_return: {
      __pyx_t_12 = __pyx_r;
      __pyx_r = 0;
      XRRFreeMonitors(__pyx_v_monitors);
      __pyx_r = __pyx_t_12;
      __pyx_t_12 = 0;
      goto __pyx_L0;
    }
    __pyx_L15:;
  }

  /* "xpra/x11/bindings/randr.pyx":1046
 *         finally:
 *             XRRFreeMonitors(monitors)
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def get_monitor_properties(self) -> Dict[str, Any]:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":1010
 * ################################################################
 * 
 *     def is_dummy16(self) -> bool:             # <<<<<<<<<<<<<<
 *         self.context_check("is_dummy16")
 *         #figure out if we're dealing with the dummy with randr 1.6 support
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.is_dummy16", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1048
 *         return True
 * 
 *     def get_monitor_properties(self) -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *         self.context_check("get_monitor_properties")
 *         return monitor_properties(self.display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_47get_monitor_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_47get_monitor_properties = {"get_monitor_properties", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_47get_monitor_properties, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_47get_monitor_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_monitor_properties (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_46get_monitor_properties(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_46get_monitor_properties(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_monitor_properties", 0);

  /* "xpra/x11/bindings/randr.pyx":1049
 * 
 *     def get_monitor_properties(self) -> Dict[str, Any]:
 *         self.context_check("get_monitor_properties")             # <<<<<<<<<<<<<<
 *         return monitor_properties(self.display)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_monitor_properties};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1050
 *     def get_monitor_properties(self) -> Dict[str, Any]:
 *         self.context_check("get_monitor_properties")
 *         return monitor_properties(self.display)             # <<<<<<<<<<<<<<
 * 
 *     def get_all_screen_properties(self) -> Dict[str, Any]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_monitor_properties(__pyx_v_self->__pyx_base.display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":1048
 *         return True
 * 
 *     def get_monitor_properties(self) -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *         self.context_check("get_monitor_properties")
 *         return monitor_properties(self.display)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_monitor_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1052
 *         return monitor_properties(self.display)
 * 
 *     def get_all_screen_properties(self) -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *         self.context_check("get_all_screen_properties")
 *         return get_all_screen_properties(self.display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_49get_all_screen_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_49get_all_screen_properties = {"get_all_screen_properties", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_49get_all_screen_properties, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_49get_all_screen_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_all_screen_properties (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_48get_all_screen_properties(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_48get_all_screen_properties(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_all_screen_properties", 0);

  /* "xpra/x11/bindings/randr.pyx":1053
 * 
 *     def get_all_screen_properties(self) -> Dict[str, Any]:
 *         self.context_check("get_all_screen_properties")             # <<<<<<<<<<<<<<
 *         return get_all_screen_properties(self.display)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_all_screen_properties};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1054
 *     def get_all_screen_properties(self) -> Dict[str, Any]:
 *         self.context_check("get_all_screen_properties")
 *         return get_all_screen_properties(self.display)             # <<<<<<<<<<<<<<
 * 
 *     def set_output_int_property(self, int output, prop_name: str, int value) -> None:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4xpra_3x11_8bindings_5randr_get_all_screen_properties(__pyx_v_self->__pyx_base.display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":1052
 *         return monitor_properties(self.display)
 * 
 *     def get_all_screen_properties(self) -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *         self.context_check("get_all_screen_properties")
 *         return get_all_screen_properties(self.display)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.get_all_screen_properties", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1056
 *         return get_all_screen_properties(self.display)
 * 
 *     def set_output_int_property(self, int output, prop_name: str, int value) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("set_output_int_property")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_51set_output_int_property(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_51set_output_int_property = {"set_output_int_property", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_51set_output_int_property, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_51set_output_int_property(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_output;
  PyObject *__pyx_v_prop_name = 0;
  int __pyx_v_value;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_output_int_property (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_output_2,&__pyx_mstate_global->__pyx_n_u_prop_name,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1056, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1056, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1056, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1056, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_output_int_property", 0) < (0)) __PYX_ERR(0, 1056, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_output_int_property", 1, 3, 3, i); __PYX_ERR(0, 1056, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1056, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1056, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1056, __pyx_L3_error)
    }
    __pyx_v_output = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_output == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1056, __pyx_L3_error)
    __pyx_v_prop_name = ((PyObject*)values[1]);
    __pyx_v_value = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1056, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_output_int_property", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1056, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.set_output_int_property", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prop_name), (&PyUnicode_Type), 0, "prop_name", 2))) __PYX_ERR(0, 1056, __pyx_L1_error)
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_50set_output_int_property(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), __pyx_v_output, __pyx_v_prop_name, __pyx_v_value);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_50set_output_int_property(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, int __pyx_v_output, PyObject *__pyx_v_prop_name, int __pyx_v_value) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenResources *__pyx_v_rsc;
  RROutput __pyx_v_rro;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_v_prop;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_v_ptype;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8[5];
  PyObject *__pyx_t_9 = NULL;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_t_10;
  unsigned char *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_output_int_property", 0);

  /* "xpra/x11/bindings/randr.pyx":1057
 * 
 *     def set_output_int_property(self, int output, prop_name: str, int value) -> None:
 *         self.context_check("set_output_int_property")             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_set_output_int_property};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1058
 *     def set_output_int_property(self, int output, prop_name: str, int value) -> None:
 *         self.context_check("set_output_int_property")
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":1059
 *         self.context_check("set_output_int_property")
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)             # <<<<<<<<<<<<<<
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":1060
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot access screen resources")
 *             return {}
*/
  __pyx_t_4 = (__pyx_v_rsc == NULL);
  if (__pyx_t_4) {

    /* "xpra/x11/bindings/randr.pyx":1061
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")             # <<<<<<<<<<<<<<
 *             return {}
 *         if output<0 or output>=rsc.noutput:
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Error_cannot_access_screen_resou};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1062
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")
 *             return {}             # <<<<<<<<<<<<<<
 *         if output<0 or output>=rsc.noutput:
 *             raise ValueError(f"invalid output number {output}, only {rsc.noutput} outputs")
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1060
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         if rsc==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot access screen resources")
 *             return {}
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1063
 *             log.error("Error: cannot access screen resources")
 *             return {}
 *         if output<0 or output>=rsc.noutput:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"invalid output number {output}, only {rsc.noutput} outputs")
 *         cdef RROutput rro = rsc.outputs[output]
*/
  __pyx_t_7 = (__pyx_v_output < 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_4 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_output >= __pyx_v_rsc->noutput);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "xpra/x11/bindings/randr.pyx":1064
 *             return {}
 *         if output<0 or output>=rsc.noutput:
 *             raise ValueError(f"invalid output number {output}, only {rsc.noutput} outputs")             # <<<<<<<<<<<<<<
 *         cdef RROutput rro = rsc.outputs[output]
 *         cdef Atom prop = self.str_to_atom(prop_name)
*/
    __pyx_t_6 = NULL;
    __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_output, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_rsc->noutput, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_invalid_output_number;
    __pyx_t_8[1] = __pyx_t_2;
    __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_only;
    __pyx_t_8[3] = __pyx_t_5;
    __pyx_t_8[4] = __pyx_mstate_global->__pyx_kp_u_outputs_2;
    __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 8, 127);
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1064, __pyx_L1_error)

    /* "xpra/x11/bindings/randr.pyx":1063
 *             log.error("Error: cannot access screen resources")
 *             return {}
 *         if output<0 or output>=rsc.noutput:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"invalid output number {output}, only {rsc.noutput} outputs")
 *         cdef RROutput rro = rsc.outputs[output]
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1065
 *         if output<0 or output>=rsc.noutput:
 *             raise ValueError(f"invalid output number {output}, only {rsc.noutput} outputs")
 *         cdef RROutput rro = rsc.outputs[output]             # <<<<<<<<<<<<<<
 *         cdef Atom prop = self.str_to_atom(prop_name)
 *         cdef Atom ptype = self.str_to_atom("INTEGER")
*/
  __pyx_v_rro = (__pyx_v_rsc->outputs[__pyx_v_output]);

  /* "xpra/x11/bindings/randr.pyx":1066
 *             raise ValueError(f"invalid output number {output}, only {rsc.noutput} outputs")
 *         cdef RROutput rro = rsc.outputs[output]
 *         cdef Atom prop = self.str_to_atom(prop_name)             # <<<<<<<<<<<<<<
 *         cdef Atom ptype = self.str_to_atom("INTEGER")
 *         data = struct.pack("@L", value)
*/
  __pyx_t_10 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.str_to_atom(((struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *)__pyx_v_self), __pyx_v_prop_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1066, __pyx_L1_error)
  __pyx_v_prop = __pyx_t_10;

  /* "xpra/x11/bindings/randr.pyx":1067
 *         cdef RROutput rro = rsc.outputs[output]
 *         cdef Atom prop = self.str_to_atom(prop_name)
 *         cdef Atom ptype = self.str_to_atom("INTEGER")             # <<<<<<<<<<<<<<
 *         data = struct.pack("@L", value)
 *         XRRChangeOutputProperty(self.display, rro, prop, ptype,
*/
  __pyx_t_10 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.str_to_atom(((struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_INTEGER); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1067, __pyx_L1_error)
  __pyx_v_ptype = __pyx_t_10;

  /* "xpra/x11/bindings/randr.pyx":1068
 *         cdef Atom prop = self.str_to_atom(prop_name)
 *         cdef Atom ptype = self.str_to_atom("INTEGER")
 *         data = struct.pack("@L", value)             # <<<<<<<<<<<<<<
 *         XRRChangeOutputProperty(self.display, rro, prop, ptype,
 *                                 32, PropModeReplace, data, 1)
*/
  __pyx_t_9 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_struct); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_9);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_L_2, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1070
 *         data = struct.pack("@L", value)
 *         XRRChangeOutputProperty(self.display, rro, prop, ptype,
 *                                 32, PropModeReplace, data, 1)             # <<<<<<<<<<<<<<
 * 
 *     def has_mode(self, unsigned int w, unsigned int h) -> bool:
*/
  __pyx_t_11 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 1070, __pyx_L1_error)

  /* "xpra/x11/bindings/randr.pyx":1069
 *         cdef Atom ptype = self.str_to_atom("INTEGER")
 *         data = struct.pack("@L", value)
 *         XRRChangeOutputProperty(self.display, rro, prop, ptype,             # <<<<<<<<<<<<<<
 *                                 32, PropModeReplace, data, 1)
 * 
*/
  XRRChangeOutputProperty(__pyx_v_self->__pyx_base.display, __pyx_v_rro, __pyx_v_prop, __pyx_v_ptype, 32, PropModeReplace, __pyx_t_11, 1);

  /* "xpra/x11/bindings/randr.pyx":1056
 *         return get_all_screen_properties(self.display)
 * 
 *     def set_output_int_property(self, int output, prop_name: str, int value) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("set_output_int_property")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.set_output_int_property", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1072
 *                                 32, PropModeReplace, data, 1)
 * 
 *     def has_mode(self, unsigned int w, unsigned int h) -> bool:             # <<<<<<<<<<<<<<
 *         self.context_check("has_mode")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_53has_mode(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_53has_mode = {"has_mode", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_53has_mode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_53has_mode(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  unsigned int __pyx_v_w;
  unsigned int __pyx_v_h;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_mode (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_w,&__pyx_mstate_global->__pyx_n_u_h,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1072, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1072, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1072, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "has_mode", 0) < (0)) __PYX_ERR(0, 1072, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("has_mode", 1, 2, 2, i); __PYX_ERR(0, 1072, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1072, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1072, __pyx_L3_error)
    }
    __pyx_v_w = __Pyx_PyLong_As_unsigned_int(values[0]); if (unlikely((__pyx_v_w == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1072, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyLong_As_unsigned_int(values[1]); if (unlikely((__pyx_v_h == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1072, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_mode", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1072, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.has_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_52has_mode(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), __pyx_v_w, __pyx_v_h);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_52has_mode(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, unsigned int __pyx_v_w, unsigned int __pyx_v_h) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenResources *__pyx_v_rsc;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_mode", 0);

  /* "xpra/x11/bindings/randr.pyx":1073
 * 
 *     def has_mode(self, unsigned int w, unsigned int h) -> bool:
 *         self.context_check("has_mode")             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_has_mode};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1074
 *     def has_mode(self, unsigned int w, unsigned int h) -> bool:
 *         self.context_check("has_mode")
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         try:
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":1075
 *         self.context_check("has_mode")
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)             # <<<<<<<<<<<<<<
 *         try:
 *             for i in range(rsc.nmode):
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":1076
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         try:             # <<<<<<<<<<<<<<
 *             for i in range(rsc.nmode):
 *                 if rsc.modes[i].width==w and rsc.modes[i].height==h:
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":1077
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         try:
 *             for i in range(rsc.nmode):             # <<<<<<<<<<<<<<
 *                 if rsc.modes[i].width==w and rsc.modes[i].height==h:
 *                     return True
*/
    __pyx_t_4 = __pyx_v_rsc->nmode;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "xpra/x11/bindings/randr.pyx":1078
 *         try:
 *             for i in range(rsc.nmode):
 *                 if rsc.modes[i].width==w and rsc.modes[i].height==h:             # <<<<<<<<<<<<<<
 *                     return True
 *             return False
*/
      __pyx_t_8 = ((__pyx_v_rsc->modes[__pyx_v_i]).width == __pyx_v_w);
      if (__pyx_t_8) {
      } else {
        __pyx_t_7 = __pyx_t_8;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_8 = ((__pyx_v_rsc->modes[__pyx_v_i]).height == __pyx_v_h);
      __pyx_t_7 = __pyx_t_8;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_7) {

        /* "xpra/x11/bindings/randr.pyx":1079
 *             for i in range(rsc.nmode):
 *                 if rsc.modes[i].width==w and rsc.modes[i].height==h:
 *                     return True             # <<<<<<<<<<<<<<
 *             return False
 *         finally:
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        goto __pyx_L3_return;

        /* "xpra/x11/bindings/randr.pyx":1078
 *         try:
 *             for i in range(rsc.nmode):
 *                 if rsc.modes[i].width==w and rsc.modes[i].height==h:             # <<<<<<<<<<<<<<
 *                     return True
 *             return False
*/
      }
    }

    /* "xpra/x11/bindings/randr.pyx":1080
 *                 if rsc.modes[i].width==w and rsc.modes[i].height==h:
 *                     return True
 *             return False             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenResources(rsc)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L3_return;
  }

  /* "xpra/x11/bindings/randr.pyx":1082
 *             return False
 *         finally:
 *             XRRFreeScreenResources(rsc)             # <<<<<<<<<<<<<<
 * 
 *     def DeleteMonitor(self, name: str):
*/
  /*finally:*/ {
    __pyx_L3_return: {
      __pyx_t_9 = __pyx_r;
      __pyx_r = 0;
      XRRFreeScreenResources(__pyx_v_rsc);
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;
    }
  }

  /* "xpra/x11/bindings/randr.pyx":1072
 *                                 32, PropModeReplace, data, 1)
 * 
 *     def has_mode(self, unsigned int w, unsigned int h) -> bool:             # <<<<<<<<<<<<<<
 *         self.context_check("has_mode")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.has_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1084
 *             XRRFreeScreenResources(rsc)
 * 
 *     def DeleteMonitor(self, name: str):             # <<<<<<<<<<<<<<
 *         log(f"DeleteMonitor(%r)", name)
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_55DeleteMonitor(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_55DeleteMonitor = {"DeleteMonitor", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_55DeleteMonitor, METH_O, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_55DeleteMonitor(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DeleteMonitor (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 0, "name", 2))) __PYX_ERR(0, 1084, __pyx_L1_error)
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_54DeleteMonitor(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), ((PyObject*)__pyx_v_name));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_54DeleteMonitor(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_name) {
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_v_name_atom;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("DeleteMonitor", 0);

  /* "xpra/x11/bindings/randr.pyx":1085
 * 
 *     def DeleteMonitor(self, name: str):
 *         log(f"DeleteMonitor(%r)", name)             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef Atom name_atom = self.str_to_atom(name)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_DeleteMonitor_r, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1086
 *     def DeleteMonitor(self, name: str):
 *         log(f"DeleteMonitor(%r)", name)
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef Atom name_atom = self.str_to_atom(name)
 *         XRRDeleteMonitor(self.display, window, name_atom)
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":1087
 *         log(f"DeleteMonitor(%r)", name)
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef Atom name_atom = self.str_to_atom(name)             # <<<<<<<<<<<<<<
 *         XRRDeleteMonitor(self.display, window, name_atom)
 *         self.XSync()
*/
  __pyx_t_5 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.str_to_atom(((struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *)__pyx_v_self), __pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1087, __pyx_L1_error)
  __pyx_v_name_atom = __pyx_t_5;

  /* "xpra/x11/bindings/randr.pyx":1088
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef Atom name_atom = self.str_to_atom(name)
 *         XRRDeleteMonitor(self.display, window, name_atom)             # <<<<<<<<<<<<<<
 *         self.XSync()
 * 
*/
  XRRDeleteMonitor(__pyx_v_self->__pyx_base.display, __pyx_v_window, __pyx_v_name_atom);

  /* "xpra/x11/bindings/randr.pyx":1089
 *         cdef Atom name_atom = self.str_to_atom(name)
 *         XRRDeleteMonitor(self.display, window, name_atom)
 *         self.XSync()             # <<<<<<<<<<<<<<
 * 
 *     def set_crtc_config(self, monitor_defs: Dict) -> None:
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_XSync, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1084
 *             XRRFreeScreenResources(rsc)
 * 
 *     def DeleteMonitor(self, name: str):             # <<<<<<<<<<<<<<
 *         log(f"DeleteMonitor(%r)", name)
 *         cdef Window window = XDefaultRootWindow(self.display)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.DeleteMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1091
 *         self.XSync()
 * 
 *     def set_crtc_config(self, monitor_defs: Dict) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_57set_crtc_config(PyObject *__pyx_v_self, PyObject *__pyx_v_monitor_defs); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_57set_crtc_config = {"set_crtc_config", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_57set_crtc_config, METH_O, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_57set_crtc_config(PyObject *__pyx_v_self, PyObject *__pyx_v_monitor_defs) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_crtc_config (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_monitor_defs), (&PyDict_Type), 0, "monitor_defs", 2))) __PYX_ERR(0, 1091, __pyx_L1_error)
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_56set_crtc_config(((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self), ((PyObject*)__pyx_v_monitor_defs));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1094
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")
 *         def dpi96(v):             # <<<<<<<<<<<<<<
 *             return round(v * 25.4 / 96)
 *         #first, find the total screen area:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_1dpi96(PyObject *__pyx_self, PyObject *__pyx_v_v); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_1dpi96 = {"dpi96", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_1dpi96, METH_O, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_1dpi96(PyObject *__pyx_self, PyObject *__pyx_v_v) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dpi96 (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(__pyx_self, ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dpi96", 0);

  /* "xpra/x11/bindings/randr.pyx":1095
 *         log(f"set_crtc_config({monitor_defs})")
 *         def dpi96(v):
 *             return round(v * 25.4 / 96)             # <<<<<<<<<<<<<<
 *         #first, find the total screen area:
 *         screen_w, screen_h = 0, 0
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_v, __pyx_mstate_global->__pyx_float_25_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_TrueDivideObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_96, 96, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":1094
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")
 *         def dpi96(v):             # <<<<<<<<<<<<<<
 *             return round(v * 25.4 / 96)
 *         #first, find the total screen area:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.set_crtc_config.dpi96", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1091
 *         self.XSync()
 * 
 *     def set_crtc_config(self, monitor_defs: Dict) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")
*/

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_56set_crtc_config(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_v_self, PyObject *__pyx_v_monitor_defs) {
  PyObject *__pyx_v_dpi96 = 0;
  PyObject *__pyx_v_screen_w = NULL;
  PyObject *__pyx_v_screen_h = NULL;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_width = NULL;
  PyObject *__pyx_v_height = NULL;
  PyObject *__pyx_v_root_w = NULL;
  PyObject *__pyx_v_root_h = NULL;
  Py_ssize_t __pyx_v_count;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Window __pyx_v_window;
  XRRScreenResources *__pyx_v_rsc;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Status __pyx_v_r;
  RRMode __pyx_v_mode;
  XRRModeInfo *__pyx_v_match_mode;
  int __pyx_v_nmonitors;
  RRCrtc __pyx_v_crtc;
  XRRCrtcInfo *__pyx_v_crtc_info;
  RROutput __pyx_v_output;
  XRROutputInfo *__pyx_v_output_info;
  XRRMonitorInfo *__pyx_v_monitors;
  XRRMonitorInfo __pyx_v_monitor;
  long __pyx_v_primary;
  PyObject *__pyx_v_output_names = NULL;
  PyObject *__pyx_v_new_modes = NULL;
  PyObject *__pyx_v_i = NULL;
  long __pyx_v_noutput;
  PyObject *__pyx_v_vrefresh = NULL;
  PyObject *__pyx_v_hz = NULL;
  PyObject *__pyx_v_hzstr = NULL;
  PyObject *__pyx_v_mode_name = NULL;
  int __pyx_v_j;
  int __pyx_v_k;
  PyObject *__pyx_v_rotation_int = NULL;
  PyObject *__pyx_v_rotation = NULL;
  PyObject *__pyx_v_mmw = NULL;
  PyObject *__pyx_v_mmh = NULL;
  PyObject *__pyx_v_posinfo = NULL;
  PyObject *__pyx_v_dpiinfo = NULL;
  PyObject *__pyx_v_dpix = NULL;
  PyObject *__pyx_v_dpiy = NULL;
  PyObject *__pyx_v_dpi = NULL;
  PyObject *__pyx_v_mi = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_monitor_names = NULL;
  PyObject *__pyx_v_all_names = NULL;
  PyObject *__pyx_v_active_names = NULL;
  PyObject *__pyx_v_ext_chars = NULL;
  PyObject *__pyx_v_seq = NULL;
  PyObject *__pyx_v_basename = NULL;
  PyObject *__pyx_v_ext = NULL;
  PyObject *__pyx_v_delete = NULL;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_v_atom;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  PyObject *__pyx_t_16[4];
  int __pyx_t_17;
  PyObject *__pyx_t_18[5];
  PyObject *(*__pyx_t_19)(PyObject *);
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21[7];
  PyObject *__pyx_t_22 = NULL;
  char const *__pyx_t_23;
  int __pyx_t_24;
  int __pyx_t_25;
  long __pyx_t_26;
  unsigned int __pyx_t_27;
  unsigned int __pyx_t_28;
  double __pyx_t_29;
  int __pyx_t_30;
  int __pyx_t_31;
  int __pyx_t_32;
  int __pyx_t_33;
  RRMode __pyx_t_34;
  PyObject *__pyx_t_35[8];
  PyObject *__pyx_t_36[9];
  PyObject *__pyx_t_37 = NULL;
  PyObject *__pyx_t_38 = NULL;
  Rotation __pyx_t_39;
  PyObject *__pyx_t_40[14];
  char const *__pyx_t_41;
  PyObject *__pyx_t_42 = NULL;
  PyObject *__pyx_t_43 = NULL;
  PyObject *__pyx_t_44 = NULL;
  PyObject *__pyx_t_45 = NULL;
  PyObject *__pyx_t_46 = NULL;
  PyObject *__pyx_t_47 = NULL;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Atom __pyx_t_51;
  __pyx_t_4xpra_3x11_8bindings_4xlib_Bool __pyx_t_52;
  PyObject *__pyx_t_53 = NULL;
  PyObject *__pyx_t_54 = NULL;
  char const *__pyx_t_55;
  char const *__pyx_t_56;
  char const *__pyx_t_57;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_crtc_config", 0);

  /* "xpra/x11/bindings/randr.pyx":1092
 * 
 *     def set_crtc_config(self, monitor_defs: Dict) -> None:
 *         self.context_check("set_crtc_config")             # <<<<<<<<<<<<<<
 *         log(f"set_crtc_config({monitor_defs})")
 *         def dpi96(v):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_set_crtc_config};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_context_check, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1093
 *     def set_crtc_config(self, monitor_defs: Dict) -> None:
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")             # <<<<<<<<<<<<<<
 *         def dpi96(v):
 *             return round(v * 25.4 / 96)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_monitor_defs, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_set_crtc_config_2;
  __pyx_t_6[1] = __pyx_t_5;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1094
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")
 *         def dpi96(v):             # <<<<<<<<<<<<<<
 *             return round(v * 25.4 / 96)
 *         #first, find the total screen area:
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_1dpi96, 0, __pyx_mstate_global->__pyx_n_u_set_crtc_config_locals_dpi96, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_dpi96 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/x11/bindings/randr.pyx":1097
 *             return round(v * 25.4 / 96)
 *         #first, find the total screen area:
 *         screen_w, screen_h = 0, 0             # <<<<<<<<<<<<<<
 *         for m in monitor_defs.values():
 *             x, y, width, height = m["geometry"]
*/
  __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = __pyx_mstate_global->__pyx_int_0;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_screen_w = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_screen_h = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1098
 *         #first, find the total screen area:
 *         screen_w, screen_h = 0, 0
 *         for m in monitor_defs.values():             # <<<<<<<<<<<<<<
 *             x, y, width, height = m["geometry"]
 *             screen_w = max(screen_w, x+width)
*/
  __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_monitor_defs, 1, __pyx_mstate_global->__pyx_n_u_values, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __pyx_t_4 = __pyx_t_1;
  __pyx_t_1 = 0;
  while (1) {
    __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_9, &__pyx_t_8, NULL, &__pyx_t_1, NULL, __pyx_t_10);
    if (unlikely(__pyx_t_11 == 0)) break;
    if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 1098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1099
 *         screen_w, screen_h = 0, 0
 *         for m in monitor_defs.values():
 *             x, y, width, height = m["geometry"]             # <<<<<<<<<<<<<<
 *             screen_w = max(screen_w, x+width)
 *             screen_h = max(screen_h, y+height)
*/
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_geometry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1099, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3);
        __Pyx_INCREF(__pyx_t_12);
      } else {
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1099, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1099, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1099, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1099, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_12);
      }
      #else
      {
        Py_ssize_t i;
        PyObject** temps[4] = {&__pyx_t_7,&__pyx_t_2,&__pyx_t_5,&__pyx_t_12};
        for (i=0; i < 4; i++) {
          PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1099, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[4] = {&__pyx_t_7,&__pyx_t_2,&__pyx_t_5,&__pyx_t_12};
      __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
      for (index=0; index < 4; index++) {
        PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < (0)) __PYX_ERR(0, 1099, __pyx_L1_error)
      __pyx_t_14 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1099, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_y, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_width, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_height, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "xpra/x11/bindings/randr.pyx":1100
 *         for m in monitor_defs.values():
 *             x, y, width, height = m["geometry"]
 *             screen_w = max(screen_w, x+width)             # <<<<<<<<<<<<<<
 *             screen_h = max(screen_h, y+height)
 *         log(f"total screen area is: {screen_w}x{screen_h}")
*/
    __pyx_t_1 = PyNumber_Add(__pyx_v_x, __pyx_v_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_screen_w);
    __pyx_t_12 = __pyx_v_screen_w;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_12, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1100, __pyx_L1_error)
    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1100, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_15) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_5 = __pyx_t_12;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_screen_w, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1101
 *             x, y, width, height = m["geometry"]
 *             screen_w = max(screen_w, x+width)
 *             screen_h = max(screen_h, y+height)             # <<<<<<<<<<<<<<
 *         log(f"total screen area is: {screen_w}x{screen_h}")
 *         if not self.has_mode(screen_w, screen_h):
*/
    __pyx_t_1 = PyNumber_Add(__pyx_v_y, __pyx_v_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_screen_h);
    __pyx_t_5 = __pyx_v_screen_h;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __pyx_L1_error)
    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1101, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_15) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_12 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_12 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_12;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF_SET(__pyx_v_screen_h, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1102
 *             screen_w = max(screen_w, x+width)
 *             screen_h = max(screen_h, y+height)
 *         log(f"total screen area is: {screen_w}x{screen_h}")             # <<<<<<<<<<<<<<
 *         if not self.has_mode(screen_w, screen_h):
 *             self.add_screen_size(screen_w, screen_h, DEFAULT_REFRESH_RATE)
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_screen_w, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_screen_h, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_total_screen_area_is;
  __pyx_t_16[1] = __pyx_t_5;
  __pyx_t_16[2] = __pyx_mstate_global->__pyx_n_u_x;
  __pyx_t_16[3] = __pyx_t_2;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_12);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1103
 *             screen_h = max(screen_h, y+height)
 *         log(f"total screen area is: {screen_w}x{screen_h}")
 *         if not self.has_mode(screen_w, screen_h):             # <<<<<<<<<<<<<<
 *             self.add_screen_size(screen_w, screen_h, DEFAULT_REFRESH_RATE)
 *         self.set_screen_size(screen_w, screen_h)
*/
  __pyx_t_12 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_12);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_v_screen_w, __pyx_v_screen_h};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_mode, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_17 = (!__pyx_t_15);
  if (__pyx_t_17) {

    /* "xpra/x11/bindings/randr.pyx":1104
 *         log(f"total screen area is: {screen_w}x{screen_h}")
 *         if not self.has_mode(screen_w, screen_h):
 *             self.add_screen_size(screen_w, screen_h, DEFAULT_REFRESH_RATE)             # <<<<<<<<<<<<<<
 *         self.set_screen_size(screen_w, screen_h)
 *         self.xrr_set_screen_size(screen_w, screen_h, dpi96(screen_w), dpi96(screen_h))
*/
    __pyx_t_12 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_DEFAULT_REFRESH_RATE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_v_screen_w, __pyx_v_screen_h, __pyx_t_7};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add_screen_size, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":1103
 *             screen_h = max(screen_h, y+height)
 *         log(f"total screen area is: {screen_w}x{screen_h}")
 *         if not self.has_mode(screen_w, screen_h):             # <<<<<<<<<<<<<<
 *             self.add_screen_size(screen_w, screen_h, DEFAULT_REFRESH_RATE)
 *         self.set_screen_size(screen_w, screen_h)
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1105
 *         if not self.has_mode(screen_w, screen_h):
 *             self.add_screen_size(screen_w, screen_h, DEFAULT_REFRESH_RATE)
 *         self.set_screen_size(screen_w, screen_h)             # <<<<<<<<<<<<<<
 *         self.xrr_set_screen_size(screen_w, screen_h, dpi96(screen_w), dpi96(screen_h))
 *         root_w, root_h = self.get_screen_size()
*/
  __pyx_t_7 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_screen_w, __pyx_v_screen_h};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_screen_size_2, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1106
 *             self.add_screen_size(screen_w, screen_h, DEFAULT_REFRESH_RATE)
 *         self.set_screen_size(screen_w, screen_h)
 *         self.xrr_set_screen_size(screen_w, screen_h, dpi96(screen_w), dpi96(screen_h))             # <<<<<<<<<<<<<<
 *         root_w, root_h = self.get_screen_size()
 *         log(f"root size is now: {root_w}x{root_h}")
*/
  __pyx_t_7 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_12 = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(__pyx_v_dpi96, __pyx_v_screen_w); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_1 = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(__pyx_v_dpi96, __pyx_v_screen_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_7, __pyx_v_screen_w, __pyx_v_screen_h, __pyx_t_12, __pyx_t_1};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_xrr_set_screen_size, __pyx_callargs+__pyx_t_3, (5-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1107
 *         self.set_screen_size(screen_w, screen_h)
 *         self.xrr_set_screen_size(screen_w, screen_h, dpi96(screen_w), dpi96(screen_h))
 *         root_w, root_h = self.get_screen_size()             # <<<<<<<<<<<<<<
 *         log(f"root size is now: {root_w}x{root_h}")
 *         count = len(monitor_defs)
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_screen_size, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1107, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_12);
    } else {
      __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_12);
    }
    #else
    __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
    index = 0; __pyx_t_1 = __pyx_t_14(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_7); if (unlikely(!__pyx_t_12)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_12);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1107, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_root_w = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_root_h = __pyx_t_12;
  __pyx_t_12 = 0;

  /* "xpra/x11/bindings/randr.pyx":1108
 *         self.xrr_set_screen_size(screen_w, screen_h, dpi96(screen_w), dpi96(screen_h))
 *         root_w, root_h = self.get_screen_size()
 *         log(f"root size is now: {root_w}x{root_h}")             # <<<<<<<<<<<<<<
 *         count = len(monitor_defs)
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_root_w, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_root_h, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_root_size_is_now;
  __pyx_t_16[1] = __pyx_t_7;
  __pyx_t_16[2] = __pyx_mstate_global->__pyx_n_u_x;
  __pyx_t_16[3] = __pyx_t_2;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_12);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_5};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1109
 *         root_w, root_h = self.get_screen_size()
 *         log(f"root size is now: {root_w}x{root_h}")
 *         count = len(monitor_defs)             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
*/
  __pyx_t_9 = PyDict_Size(__pyx_v_monitor_defs); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1109, __pyx_L1_error)
  __pyx_v_count = __pyx_t_9;

  /* "xpra/x11/bindings/randr.pyx":1110
 *         log(f"root size is now: {root_w}x{root_h}")
 *         count = len(monitor_defs)
 *         cdef Window window = XDefaultRootWindow(self.display)             # <<<<<<<<<<<<<<
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         cdef Status r
*/
  __pyx_v_window = XDefaultRootWindow(__pyx_v_self->__pyx_base.display);

  /* "xpra/x11/bindings/randr.pyx":1111
 *         count = len(monitor_defs)
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)             # <<<<<<<<<<<<<<
 *         cdef Status r
 *         if rsc==NULL:
*/
  __pyx_v_rsc = XRRGetScreenResourcesCurrent(__pyx_v_self->__pyx_base.display, __pyx_v_window);

  /* "xpra/x11/bindings/randr.pyx":1113
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         cdef Status r
 *         if rsc==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot access screen resources")
 *             return False
*/
  __pyx_t_17 = (__pyx_v_rsc == NULL);
  if (__pyx_t_17) {

    /* "xpra/x11/bindings/randr.pyx":1114
 *         cdef Status r
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")             # <<<<<<<<<<<<<<
 *             return False
 *         if max(monitor_defs.keys())>=rsc.ncrtc or min(monitor_defs.keys())<0:
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_12);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_Error_cannot_access_screen_resou};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":1115
 *         if rsc==NULL:
 *             log.error("Error: cannot access screen resources")
 *             return False             # <<<<<<<<<<<<<<
 *         if max(monitor_defs.keys())>=rsc.ncrtc or min(monitor_defs.keys())<0:
 *             log.error("Error: invalid monitor indexes in %s", csv(monitor_defs.keys()))
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1113
 *         cdef XRRScreenResources *rsc = XRRGetScreenResourcesCurrent(self.display, window)
 *         cdef Status r
 *         if rsc==NULL:             # <<<<<<<<<<<<<<
 *             log.error("Error: cannot access screen resources")
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1116
 *             log.error("Error: cannot access screen resources")
 *             return False
 *         if max(monitor_defs.keys())>=rsc.ncrtc or min(monitor_defs.keys())<0:             # <<<<<<<<<<<<<<
 *             log.error("Error: invalid monitor indexes in %s", csv(monitor_defs.keys()))
 *             return False
*/
  __pyx_t_12 = NULL;
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_monitor_defs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_1};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_rsc->ncrtc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (!__pyx_t_15) {
  } else {
    __pyx_t_17 = __pyx_t_15;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_1 = NULL;
  __pyx_t_4 = __Pyx_PyDict_Keys(__pyx_v_monitor_defs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
    __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
  }
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_17 = __pyx_t_15;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_17) {

    /* "xpra/x11/bindings/randr.pyx":1117
 *             return False
 *         if max(monitor_defs.keys())>=rsc.ncrtc or min(monitor_defs.keys())<0:
 *             log.error("Error: invalid monitor indexes in %s", csv(monitor_defs.keys()))             # <<<<<<<<<<<<<<
 *             return False
 *         if rsc.ncrtc<count:
*/
    __pyx_t_12 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_csv); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = __Pyx_PyDict_Keys(__pyx_v_monitor_defs); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_13};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_12);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_Error_invalid_monitor_indexes_in, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":1118
 *         if max(monitor_defs.keys())>=rsc.ncrtc or min(monitor_defs.keys())<0:
 *             log.error("Error: invalid monitor indexes in %s", csv(monitor_defs.keys()))
 *             return False             # <<<<<<<<<<<<<<
 *         if rsc.ncrtc<count:
 *             log.error(f"Error: only {rsc.ncrtc} crtcs for {count} monitors")
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1116
 *             log.error("Error: cannot access screen resources")
 *             return False
 *         if max(monitor_defs.keys())>=rsc.ncrtc or min(monitor_defs.keys())<0:             # <<<<<<<<<<<<<<
 *             log.error("Error: invalid monitor indexes in %s", csv(monitor_defs.keys()))
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1119
 *             log.error("Error: invalid monitor indexes in %s", csv(monitor_defs.keys()))
 *             return False
 *         if rsc.ncrtc<count:             # <<<<<<<<<<<<<<
 *             log.error(f"Error: only {rsc.ncrtc} crtcs for {count} monitors")
 *             return False
*/
  __pyx_t_17 = (__pyx_v_rsc->ncrtc < __pyx_v_count);
  if (__pyx_t_17) {

    /* "xpra/x11/bindings/randr.pyx":1120
 *             return False
 *         if rsc.ncrtc<count:
 *             log.error(f"Error: only {rsc.ncrtc} crtcs for {count} monitors")             # <<<<<<<<<<<<<<
 *             return False
 *         if rsc.noutput<count:
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_rsc->ncrtc, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_count, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_18[0] = __pyx_mstate_global->__pyx_kp_u_Error_only;
    __pyx_t_18[1] = __pyx_t_1;
    __pyx_t_18[2] = __pyx_mstate_global->__pyx_kp_u_crtcs_for;
    __pyx_t_18[3] = __pyx_t_7;
    __pyx_t_18[4] = __pyx_mstate_global->__pyx_kp_u_monitors_2;
    __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_18, 5, 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 9, 127);
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_12);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_13};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":1121
 *         if rsc.ncrtc<count:
 *             log.error(f"Error: only {rsc.ncrtc} crtcs for {count} monitors")
 *             return False             # <<<<<<<<<<<<<<
 *         if rsc.noutput<count:
 *             log.error(f"Error: only {rsc.noutput} outputs for {count} monitors")
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1119
 *             log.error("Error: invalid monitor indexes in %s", csv(monitor_defs.keys()))
 *             return False
 *         if rsc.ncrtc<count:             # <<<<<<<<<<<<<<
 *             log.error(f"Error: only {rsc.ncrtc} crtcs for {count} monitors")
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1122
 *             log.error(f"Error: only {rsc.ncrtc} crtcs for {count} monitors")
 *             return False
 *         if rsc.noutput<count:             # <<<<<<<<<<<<<<
 *             log.error(f"Error: only {rsc.noutput} outputs for {count} monitors")
 *             return False
*/
  __pyx_t_17 = (__pyx_v_rsc->noutput < __pyx_v_count);
  if (__pyx_t_17) {

    /* "xpra/x11/bindings/randr.pyx":1123
 *             return False
 *         if rsc.noutput<count:
 *             log.error(f"Error: only {rsc.noutput} outputs for {count} monitors")             # <<<<<<<<<<<<<<
 *             return False
 *         cdef RRMode mode
*/
    __pyx_t_12 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyUnicode_From_int(__pyx_v_rsc->noutput, 0, ' ', 'd'); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_7 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_count, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_18[0] = __pyx_mstate_global->__pyx_kp_u_Error_only;
    __pyx_t_18[1] = __pyx_t_13;
    __pyx_t_18[2] = __pyx_mstate_global->__pyx_kp_u_outputs_for;
    __pyx_t_18[3] = __pyx_t_7;
    __pyx_t_18[4] = __pyx_mstate_global->__pyx_kp_u_monitors_2;
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_18, 5, 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 9, 127);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_12);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "xpra/x11/bindings/randr.pyx":1124
 *         if rsc.noutput<count:
 *             log.error(f"Error: only {rsc.noutput} outputs for {count} monitors")
 *             return False             # <<<<<<<<<<<<<<
 *         cdef RRMode mode
 *         cdef XRRModeInfo *match_mode = NULL
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1122
 *             log.error(f"Error: only {rsc.ncrtc} crtcs for {count} monitors")
 *             return False
 *         if rsc.noutput<count:             # <<<<<<<<<<<<<<
 *             log.error(f"Error: only {rsc.noutput} outputs for {count} monitors")
 *             return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1126
 *             return False
 *         cdef RRMode mode
 *         cdef XRRModeInfo *match_mode = NULL             # <<<<<<<<<<<<<<
 *         cdef int nmonitors
 *         cdef RRCrtc crtc
*/
  __pyx_v_match_mode = NULL;

  /* "xpra/x11/bindings/randr.pyx":1129
 *         cdef int nmonitors
 *         cdef RRCrtc crtc
 *         cdef XRRCrtcInfo *crtc_info = NULL             # <<<<<<<<<<<<<<
 *         cdef RROutput output
 *         cdef XRROutputInfo *output_info = NULL
*/
  __pyx_v_crtc_info = NULL;

  /* "xpra/x11/bindings/randr.pyx":1131
 *         cdef XRRCrtcInfo *crtc_info = NULL
 *         cdef RROutput output
 *         cdef XRROutputInfo *output_info = NULL             # <<<<<<<<<<<<<<
 *         cdef XRRMonitorInfo *monitors
 *         cdef XRRMonitorInfo monitor
*/
  __pyx_v_output_info = NULL;

  /* "xpra/x11/bindings/randr.pyx":1134
 *         cdef XRRMonitorInfo *monitors
 *         cdef XRRMonitorInfo monitor
 *         primary = 0             # <<<<<<<<<<<<<<
 *         # we can't have monitor names the same as output names,
 *         # with the dummy driver, we have 16 outputs:
*/
  __pyx_v_primary = 0;

  /* "xpra/x11/bindings/randr.pyx":1138
 *         # with the dummy driver, we have 16 outputs:
 *         # DUMMY0 to DUMMY15
 *         output_names = []             # <<<<<<<<<<<<<<
 *         new_modes = {}
 *         try:
*/
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_output_names = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1139
 *         # DUMMY0 to DUMMY15
 *         output_names = []
 *         new_modes = {}             # <<<<<<<<<<<<<<
 *         try:
 *             for i in range(rsc.ncrtc):
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_new_modes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":1140
 *         output_names = []
 *         new_modes = {}
 *         try:             # <<<<<<<<<<<<<<
 *             for i in range(rsc.ncrtc):
 *                 m = monitor_defs.get(i, {})
*/
  /*try:*/ {

    /* "xpra/x11/bindings/randr.pyx":1141
 *         new_modes = {}
 *         try:
 *             for i in range(rsc.ncrtc):             # <<<<<<<<<<<<<<
 *                 m = monitor_defs.get(i, {})
 *                 crtc = rsc.crtcs[i]
*/
    __pyx_t_5 = NULL;
    __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_rsc->ncrtc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1141, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1141, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1141, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1141, __pyx_L17_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      {
        __pyx_t_4 = __pyx_t_19(__pyx_t_1);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1141, __pyx_L17_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "xpra/x11/bindings/randr.pyx":1142
 *         try:
 *             for i in range(rsc.ncrtc):
 *                 m = monitor_defs.get(i, {})             # <<<<<<<<<<<<<<
 *                 crtc = rsc.crtcs[i]
 *                 assert rsc.noutput>i
*/
      __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1142, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_monitor_defs, __pyx_v_i, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1142, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "xpra/x11/bindings/randr.pyx":1143
 *             for i in range(rsc.ncrtc):
 *                 m = monitor_defs.get(i, {})
 *                 crtc = rsc.crtcs[i]             # <<<<<<<<<<<<<<
 *                 assert rsc.noutput>i
 *                 output = rsc.outputs[i]
*/
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1143, __pyx_L17_error)
      __pyx_v_crtc = (__pyx_v_rsc->crtcs[__pyx_t_9]);

      /* "xpra/x11/bindings/randr.pyx":1144
 *                 m = monitor_defs.get(i, {})
 *                 crtc = rsc.crtcs[i]
 *                 assert rsc.noutput>i             # <<<<<<<<<<<<<<
 *                 output = rsc.outputs[i]
 *                 log(f"{i}: crtc {crtc} and output {output}: {m}")
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_rsc->noutput); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1144, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_i, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1144, __pyx_L17_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1144, __pyx_L17_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_17)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
          __PYX_ERR(0, 1144, __pyx_L17_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(0, 1144, __pyx_L17_error)
      #endif

      /* "xpra/x11/bindings/randr.pyx":1145
 *                 crtc = rsc.crtcs[i]
 *                 assert rsc.noutput>i
 *                 output = rsc.outputs[i]             # <<<<<<<<<<<<<<
 *                 log(f"{i}: crtc {crtc} and output {output}: {m}")
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, crtc)
*/
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1145, __pyx_L17_error)
      __pyx_v_output = (__pyx_v_rsc->outputs[__pyx_t_9]);

      /* "xpra/x11/bindings/randr.pyx":1146
 *                 assert rsc.noutput>i
 *                 output = rsc.outputs[i]
 *                 log(f"{i}: crtc {crtc} and output {output}: {m}")             # <<<<<<<<<<<<<<
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, crtc)
 *                 if not crtc_info:
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1146, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1146, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_13 = __Pyx_PyUnicode_From_RRCrtc(__pyx_v_crtc, 0, ' ', 'd'); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1146, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_2 = __Pyx_PyUnicode_From_RROutput(__pyx_v_output, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1146, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_20 = __Pyx_PyObject_FormatSimple(__pyx_v_m, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1146, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_20);
      __pyx_t_21[0] = __pyx_t_7;
      __pyx_t_21[1] = __pyx_mstate_global->__pyx_kp_u_crtc;
      __pyx_t_21[2] = __pyx_t_13;
      __pyx_t_21[3] = __pyx_mstate_global->__pyx_kp_u_and_output;
      __pyx_t_21[4] = __pyx_t_2;
      __pyx_t_21[5] = __pyx_mstate_global->__pyx_kp_u__10;
      __pyx_t_21[6] = __pyx_t_20;
      __pyx_t_22 = __Pyx_PyUnicode_Join(__pyx_t_21, 7, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20));
      if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1146, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_22);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_12);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_22};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1146, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "xpra/x11/bindings/randr.pyx":1147
 *                 output = rsc.outputs[i]
 *                 log(f"{i}: crtc {crtc} and output {output}: {m}")
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, crtc)             # <<<<<<<<<<<<<<
 *                 if not crtc_info:
 *                     log.error(f"Error: crtc {i} not found ({crtc:#x})")
*/
      __pyx_v_crtc_info = XRRGetCrtcInfo(__pyx_v_self->__pyx_base.display, __pyx_v_rsc, __pyx_v_crtc);

      /* "xpra/x11/bindings/randr.pyx":1148
 *                 log(f"{i}: crtc {crtc} and output {output}: {m}")
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, crtc)
 *                 if not crtc_info:             # <<<<<<<<<<<<<<
 *                     log.error(f"Error: crtc {i} not found ({crtc:#x})")
 *                     continue
*/
      __pyx_t_17 = (!(__pyx_v_crtc_info != 0));
      if (__pyx_t_17) {

        /* "xpra/x11/bindings/randr.pyx":1149
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, crtc)
 *                 if not crtc_info:
 *                     log.error(f"Error: crtc {i} not found ({crtc:#x})")             # <<<<<<<<<<<<<<
 *                     continue
 *                 try:
*/
        __pyx_t_12 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1149, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1149, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __pyx_t_22 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1149, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_20 = __Pyx_PyLong_From_unsigned_long(__pyx_v_crtc); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1149, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_2 = __Pyx_PyObject_Format(__pyx_t_20, __pyx_mstate_global->__pyx_kp_u_x_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __pyx_t_18[0] = __pyx_mstate_global->__pyx_kp_u_Error_crtc;
        __pyx_t_18[1] = __pyx_t_22;
        __pyx_t_18[2] = __pyx_mstate_global->__pyx_kp_u_not_found;
        __pyx_t_18[3] = __pyx_t_2;
        __pyx_t_18[4] = __pyx_mstate_global->__pyx_kp_u__5;
        __pyx_t_20 = __Pyx_PyUnicode_Join(__pyx_t_18, 5, 12 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_22) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_22) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
        if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1149, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_12);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_20};
          __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "xpra/x11/bindings/randr.pyx":1150
 *                 if not crtc_info:
 *                     log.error(f"Error: crtc {i} not found ({crtc:#x})")
 *                     continue             # <<<<<<<<<<<<<<
 *                 try:
 *                     output_info = XRRGetOutputInfo(self.display, rsc, output)
*/
        goto __pyx_L19_continue;

        /* "xpra/x11/bindings/randr.pyx":1148
 *                 log(f"{i}: crtc {crtc} and output {output}: {m}")
 *                 crtc_info = XRRGetCrtcInfo(self.display, rsc, crtc)
 *                 if not crtc_info:             # <<<<<<<<<<<<<<
 *                     log.error(f"Error: crtc {i} not found ({crtc:#x})")
 *                     continue
*/
      }

      /* "xpra/x11/bindings/randr.pyx":1151
 *                     log.error(f"Error: crtc {i} not found ({crtc:#x})")
 *                     continue
 *                 try:             # <<<<<<<<<<<<<<
 *                     output_info = XRRGetOutputInfo(self.display, rsc, output)
 *                     if not output_info:
*/
      /*try:*/ {

        /* "xpra/x11/bindings/randr.pyx":1152
 *                     continue
 *                 try:
 *                     output_info = XRRGetOutputInfo(self.display, rsc, output)             # <<<<<<<<<<<<<<
 *                     if not output_info:
 *                         log.error(f"Error: output {i} not found ({output:#x})")
*/
        __pyx_v_output_info = XRRGetOutputInfo(__pyx_v_self->__pyx_base.display, __pyx_v_rsc, __pyx_v_output);

        /* "xpra/x11/bindings/randr.pyx":1153
 *                 try:
 *                     output_info = XRRGetOutputInfo(self.display, rsc, output)
 *                     if not output_info:             # <<<<<<<<<<<<<<
 *                         log.error(f"Error: output {i} not found ({output:#x})")
 *                         continue
*/
        __pyx_t_17 = (!(__pyx_v_output_info != 0));
        if (__pyx_t_17) {

          /* "xpra/x11/bindings/randr.pyx":1154
 *                     output_info = XRRGetOutputInfo(self.display, rsc, output)
 *                     if not output_info:
 *                         log.error(f"Error: output {i} not found ({output:#x})")             # <<<<<<<<<<<<<<
 *                         continue
 *                     output_names.append(s(output_info.name[:output_info.nameLen]))
*/
          __pyx_t_5 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1154, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1154, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __pyx_t_20 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1154, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_output); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1154, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_22 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_x_2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1154, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_18[0] = __pyx_mstate_global->__pyx_kp_u_Error_output;
          __pyx_t_18[1] = __pyx_t_20;
          __pyx_t_18[2] = __pyx_mstate_global->__pyx_kp_u_not_found;
          __pyx_t_18[3] = __pyx_t_22;
          __pyx_t_18[4] = __pyx_mstate_global->__pyx_kp_u__5;
          __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_18, 5, 14 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20) + 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_22) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_22));
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1154, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_12);
            assert(__pyx_t_5);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2};
            __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1154, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_4);
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "xpra/x11/bindings/randr.pyx":1155
 *                     if not output_info:
 *                         log.error(f"Error: output {i} not found ({output:#x})")
 *                         continue             # <<<<<<<<<<<<<<
 *                     output_names.append(s(output_info.name[:output_info.nameLen]))
 *                     if crtc_info.noutput==0 and output_info.connection==RR_Disconnected and not m:
*/
          goto __pyx_L22_continue;

          /* "xpra/x11/bindings/randr.pyx":1153
 *                 try:
 *                     output_info = XRRGetOutputInfo(self.display, rsc, output)
 *                     if not output_info:             # <<<<<<<<<<<<<<
 *                         log.error(f"Error: output {i} not found ({output:#x})")
 *                         continue
*/
        }

        /* "xpra/x11/bindings/randr.pyx":1156
 *                         log.error(f"Error: output {i} not found ({output:#x})")
 *                         continue
 *                     output_names.append(s(output_info.name[:output_info.nameLen]))             # <<<<<<<<<<<<<<
 *                     if crtc_info.noutput==0 and output_info.connection==RR_Disconnected and not m:
 *                         #crtc is not enabled and the corresponding output is not connected,
*/
        __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_output_info->name + 0, __pyx_v_output_info->nameLen - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1156, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_23 = __Pyx_PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_23) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L25_error)
        __pyx_t_12 = __pyx_f_4xpra_3x11_8bindings_5randr_s(__pyx_t_23); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1156, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_output_names, __pyx_t_12); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1156, __pyx_L25_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1157
 *                         continue
 *                     output_names.append(s(output_info.name[:output_info.nameLen]))
 *                     if crtc_info.noutput==0 and output_info.connection==RR_Disconnected and not m:             # <<<<<<<<<<<<<<
 *                         #crtc is not enabled and the corresponding output is not connected,
 *                         #which is exactly what we want, so just leave it alone
*/
        __pyx_t_15 = (__pyx_v_crtc_info->noutput == 0);
        if (__pyx_t_15) {
        } else {
          __pyx_t_17 = __pyx_t_15;
          goto __pyx_L29_bool_binop_done;
        }
        __pyx_t_15 = (__pyx_v_output_info->connection == RR_Disconnected);
        if (__pyx_t_15) {
        } else {
          __pyx_t_17 = __pyx_t_15;
          goto __pyx_L29_bool_binop_done;
        }
        __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_v_m); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1157, __pyx_L25_error)
        __pyx_t_25 = (!__pyx_t_15);
        __pyx_t_17 = __pyx_t_25;
        __pyx_L29_bool_binop_done:;
        if (__pyx_t_17) {

          /* "xpra/x11/bindings/randr.pyx":1160
 *                         #crtc is not enabled and the corresponding output is not connected,
 *                         #which is exactly what we want, so just leave it alone
 *                         log(f"crtc and output {i} are already disabled")             # <<<<<<<<<<<<<<
 *                         continue
 *                     noutput = 1
*/
          __pyx_t_4 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1160, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1160, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_crtc_and_output;
          __pyx_t_6[1] = __pyx_t_5;
          __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_are_already_disabled;
          __pyx_t_22 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 21, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
          if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1160, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
            assert(__pyx_t_4);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_22};
            __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1160, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "xpra/x11/bindings/randr.pyx":1161
 *                         #which is exactly what we want, so just leave it alone
 *                         log(f"crtc and output {i} are already disabled")
 *                         continue             # <<<<<<<<<<<<<<
 *                     noutput = 1
 *                     mode = 0
*/
          goto __pyx_L22_continue;

          /* "xpra/x11/bindings/randr.pyx":1157
 *                         continue
 *                     output_names.append(s(output_info.name[:output_info.nameLen]))
 *                     if crtc_info.noutput==0 and output_info.connection==RR_Disconnected and not m:             # <<<<<<<<<<<<<<
 *                         #crtc is not enabled and the corresponding output is not connected,
 *                         #which is exactly what we want, so just leave it alone
*/
        }

        /* "xpra/x11/bindings/randr.pyx":1162
 *                         log(f"crtc and output {i} are already disabled")
 *                         continue
 *                     noutput = 1             # <<<<<<<<<<<<<<
 *                     mode = 0
 *                     vrefresh = 0
*/
        __pyx_v_noutput = 1;

        /* "xpra/x11/bindings/randr.pyx":1163
 *                         continue
 *                     noutput = 1
 *                     mode = 0             # <<<<<<<<<<<<<<
 *                     vrefresh = 0
 *                     hz = 60.0
*/
        __pyx_v_mode = 0;

        /* "xpra/x11/bindings/randr.pyx":1164
 *                     noutput = 1
 *                     mode = 0
 *                     vrefresh = 0             # <<<<<<<<<<<<<<
 *                     hz = 60.0
 *                     x, y, width, height = 0, 0, 1024, 768
*/
        __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
        __Pyx_XDECREF_SET(__pyx_v_vrefresh, __pyx_mstate_global->__pyx_int_0);

        /* "xpra/x11/bindings/randr.pyx":1165
 *                     mode = 0
 *                     vrefresh = 0
 *                     hz = 60.0             # <<<<<<<<<<<<<<
 *                     x, y, width, height = 0, 0, 1024, 768
 *                     if m:
*/
        __Pyx_INCREF(__pyx_mstate_global->__pyx_float_60_0);
        __Pyx_XDECREF_SET(__pyx_v_hz, __pyx_mstate_global->__pyx_float_60_0);

        /* "xpra/x11/bindings/randr.pyx":1166
 *                     vrefresh = 0
 *                     hz = 60.0
 *                     x, y, width, height = 0, 0, 1024, 768             # <<<<<<<<<<<<<<
 *                     if m:
 *                         if m.get("primary", False):
*/
        __pyx_t_12 = __pyx_mstate_global->__pyx_int_0;
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_22 = __pyx_mstate_global->__pyx_int_1024;
        __Pyx_INCREF(__pyx_t_22);
        __pyx_t_4 = __pyx_mstate_global->__pyx_int_768;
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_12);
        __pyx_t_12 = 0;
        __Pyx_XDECREF_SET(__pyx_v_y, __pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_XDECREF_SET(__pyx_v_width, __pyx_t_22);
        __pyx_t_22 = 0;
        __Pyx_XDECREF_SET(__pyx_v_height, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "xpra/x11/bindings/randr.pyx":1167
 *                     hz = 60.0
 *                     x, y, width, height = 0, 0, 1024, 768
 *                     if m:             # <<<<<<<<<<<<<<
 *                         if m.get("primary", False):
 *                             primary = i
*/
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_m); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1167, __pyx_L25_error)
        if (__pyx_t_17) {

          /* "xpra/x11/bindings/randr.pyx":1168
 *                     x, y, width, height = 0, 0, 1024, 768
 *                     if m:
 *                         if m.get("primary", False):             # <<<<<<<<<<<<<<
 *                             primary = i
 *                         x, y, width, height = m["geometry"]
*/
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1168, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1168, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1168, __pyx_L25_error)
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1169
 *                     if m:
 *                         if m.get("primary", False):
 *                             primary = i             # <<<<<<<<<<<<<<
 *                         x, y, width, height = m["geometry"]
 *                         vrefresh = m.get("refresh-rate", 0)
*/
            __pyx_t_26 = __Pyx_PyLong_As_long(__pyx_v_i); if (unlikely((__pyx_t_26 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1169, __pyx_L25_error)
            __pyx_v_primary = __pyx_t_26;

            /* "xpra/x11/bindings/randr.pyx":1168
 *                     x, y, width, height = 0, 0, 1024, 768
 *                     if m:
 *                         if m.get("primary", False):             # <<<<<<<<<<<<<<
 *                             primary = i
 *                         x, y, width, height = m["geometry"]
*/
          }

          /* "xpra/x11/bindings/randr.pyx":1170
 *                         if m.get("primary", False):
 *                             primary = i
 *                         x, y, width, height = m["geometry"]             # <<<<<<<<<<<<<<
 *                         vrefresh = m.get("refresh-rate", 0)
 *                         if vrefresh <= 0:
*/
          __pyx_t_22 = __Pyx_PyObject_Dict_GetItem(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_geometry); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1170, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          if ((likely(PyTuple_CheckExact(__pyx_t_22))) || (PyList_CheckExact(__pyx_t_22))) {
            PyObject* sequence = __pyx_t_22;
            Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
            if (unlikely(size != 4)) {
              if (size > 4) __Pyx_RaiseTooManyValuesError(4);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 1170, __pyx_L25_error)
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            if (likely(PyTuple_CheckExact(sequence))) {
              __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
              __Pyx_INCREF(__pyx_t_4);
              __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
              __Pyx_INCREF(__pyx_t_2);
              __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2);
              __Pyx_INCREF(__pyx_t_12);
              __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
              __Pyx_INCREF(__pyx_t_5);
            } else {
              __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
              if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1170, __pyx_L25_error)
              __Pyx_XGOTREF(__pyx_t_4);
              __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1170, __pyx_L25_error)
              __Pyx_XGOTREF(__pyx_t_2);
              __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
              if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1170, __pyx_L25_error)
              __Pyx_XGOTREF(__pyx_t_12);
              __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
              if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1170, __pyx_L25_error)
              __Pyx_XGOTREF(__pyx_t_5);
            }
            #else
            {
              Py_ssize_t i;
              PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_2,&__pyx_t_12,&__pyx_t_5};
              for (i=0; i < 4; i++) {
                PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1170, __pyx_L25_error)
                __Pyx_GOTREF(item);
                *(temps[i]) = item;
              }
            }
            #endif
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          } else {
            Py_ssize_t index = -1;
            PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_2,&__pyx_t_12,&__pyx_t_5};
            __pyx_t_20 = PyObject_GetIter(__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1170, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_20);
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_20);
            for (index=0; index < 4; index++) {
              PyObject* item = __pyx_t_14(__pyx_t_20); if (unlikely(!item)) goto __pyx_L34_unpacking_failed;
              __Pyx_GOTREF(item);
              *(temps[index]) = item;
            }
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_20), 4) < (0)) __PYX_ERR(0, 1170, __pyx_L25_error)
            __pyx_t_14 = NULL;
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            goto __pyx_L35_unpacking_done;
            __pyx_L34_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_14 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            __PYX_ERR(0, 1170, __pyx_L25_error)
            __pyx_L35_unpacking_done:;
          }
          __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_4);
          __pyx_t_4 = 0;
          __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
          __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_width, __pyx_t_12);
          __pyx_t_12 = 0;
          __Pyx_DECREF_SET(__pyx_v_height, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1171
 *                             primary = i
 *                         x, y, width, height = m["geometry"]
 *                         vrefresh = m.get("refresh-rate", 0)             # <<<<<<<<<<<<<<
 *                         if vrefresh <= 0:
 *                             vrefresh = DEFAULT_REFRESH_RATE
*/
          __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1171, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1171, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_DECREF_SET(__pyx_v_vrefresh, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1172
 *                         x, y, width, height = m["geometry"]
 *                         vrefresh = m.get("refresh-rate", 0)
 *                         if vrefresh <= 0:             # <<<<<<<<<<<<<<
 *                             vrefresh = DEFAULT_REFRESH_RATE
 *                         if vrefresh < 1000:
*/
          __pyx_t_5 = PyObject_RichCompare(__pyx_v_vrefresh, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1172, __pyx_L25_error)
          __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1172, __pyx_L25_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1173
 *                         vrefresh = m.get("refresh-rate", 0)
 *                         if vrefresh <= 0:
 *                             vrefresh = DEFAULT_REFRESH_RATE             # <<<<<<<<<<<<<<
 *                         if vrefresh < 1000:
 *                             hz = vrefresh
*/
            __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_DEFAULT_REFRESH_RATE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1173, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF_SET(__pyx_v_vrefresh, __pyx_t_5);
            __pyx_t_5 = 0;

            /* "xpra/x11/bindings/randr.pyx":1172
 *                         x, y, width, height = m["geometry"]
 *                         vrefresh = m.get("refresh-rate", 0)
 *                         if vrefresh <= 0:             # <<<<<<<<<<<<<<
 *                             vrefresh = DEFAULT_REFRESH_RATE
 *                         if vrefresh < 1000:
*/
          }

          /* "xpra/x11/bindings/randr.pyx":1174
 *                         if vrefresh <= 0:
 *                             vrefresh = DEFAULT_REFRESH_RATE
 *                         if vrefresh < 1000:             # <<<<<<<<<<<<<<
 *                             hz = vrefresh
 *                         else:
*/
          __pyx_t_5 = PyObject_RichCompare(__pyx_v_vrefresh, __pyx_mstate_global->__pyx_int_1000, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1174, __pyx_L25_error)
          __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1174, __pyx_L25_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1175
 *                             vrefresh = DEFAULT_REFRESH_RATE
 *                         if vrefresh < 1000:
 *                             hz = vrefresh             # <<<<<<<<<<<<<<
 *                         else:
 *                             hz = vrefresh / 1000
*/
            __Pyx_INCREF(__pyx_v_vrefresh);
            __Pyx_DECREF_SET(__pyx_v_hz, __pyx_v_vrefresh);

            /* "xpra/x11/bindings/randr.pyx":1174
 *                         if vrefresh <= 0:
 *                             vrefresh = DEFAULT_REFRESH_RATE
 *                         if vrefresh < 1000:             # <<<<<<<<<<<<<<
 *                             hz = vrefresh
 *                         else:
*/
            goto __pyx_L37;
          }

          /* "xpra/x11/bindings/randr.pyx":1177
 *                             hz = vrefresh
 *                         else:
 *                             hz = vrefresh / 1000             # <<<<<<<<<<<<<<
 *                         hzstr = str(hz)
 *                         if hzstr.find(".") > 0:
*/
          /*else*/ {
            __pyx_t_5 = __Pyx_PyLong_TrueDivideObjC(__pyx_v_vrefresh, __pyx_mstate_global->__pyx_int_1000, 0x3E8, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1177, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF_SET(__pyx_v_hz, __pyx_t_5);
            __pyx_t_5 = 0;
          }
          __pyx_L37:;

          /* "xpra/x11/bindings/randr.pyx":1178
 *                         else:
 *                             hz = vrefresh / 1000
 *                         hzstr = str(hz)             # <<<<<<<<<<<<<<
 *                         if hzstr.find(".") > 0:
 *                             hzstr = hzstr.rstrip("0").rstrip(".")
*/
          __pyx_t_5 = __Pyx_PyObject_Unicode(__pyx_v_hz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1178, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_v_hzstr, ((PyObject*)__pyx_t_5));
          __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1179
 *                             hz = vrefresh / 1000
 *                         hzstr = str(hz)
 *                         if hzstr.find(".") > 0:             # <<<<<<<<<<<<<<
 *                             hzstr = hzstr.rstrip("0").rstrip(".")
 *                         mode_name = f"{width}x{height}@{hzstr}"
*/
          __pyx_t_9 = PyUnicode_Find(__pyx_v_hzstr, __pyx_mstate_global->__pyx_kp_u__4, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-2))) __PYX_ERR(0, 1179, __pyx_L25_error)
          __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1179, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_22 = PyObject_RichCompare(__pyx_t_5, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_22); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1179, __pyx_L25_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1179, __pyx_L25_error)
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1180
 *                         hzstr = str(hz)
 *                         if hzstr.find(".") > 0:
 *                             hzstr = hzstr.rstrip("0").rstrip(".")             # <<<<<<<<<<<<<<
 *                         mode_name = f"{width}x{height}@{hzstr}"
 *                         log("calculating mode %r", mode_name)
*/
            __pyx_t_12 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__rstrip, __pyx_v_hzstr, __pyx_mstate_global->__pyx_kp_u_0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1180, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_5 = __pyx_t_12;
            __Pyx_INCREF(__pyx_t_5);
            __pyx_t_3 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u__4};
              __pyx_t_22 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_rstrip, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1180, __pyx_L25_error)
              __Pyx_GOTREF(__pyx_t_22);
            }
            __Pyx_DECREF_SET(__pyx_v_hzstr, ((PyObject*)__pyx_t_22));
            __pyx_t_22 = 0;

            /* "xpra/x11/bindings/randr.pyx":1179
 *                             hz = vrefresh / 1000
 *                         hzstr = str(hz)
 *                         if hzstr.find(".") > 0:             # <<<<<<<<<<<<<<
 *                             hzstr = hzstr.rstrip("0").rstrip(".")
 *                         mode_name = f"{width}x{height}@{hzstr}"
*/
          }

          /* "xpra/x11/bindings/randr.pyx":1181
 *                         if hzstr.find(".") > 0:
 *                             hzstr = hzstr.rstrip("0").rstrip(".")
 *                         mode_name = f"{width}x{height}@{hzstr}"             # <<<<<<<<<<<<<<
 *                         log("calculating mode %r", mode_name)
 *                         match_mode = self.calculate_mode(mode_name, width, height, hz)
*/
          __pyx_t_22 = __Pyx_PyObject_FormatSimple(__pyx_v_width, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1181, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_height, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1181, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_18[0] = __pyx_t_22;
          __pyx_t_18[1] = __pyx_mstate_global->__pyx_n_u_x;
          __pyx_t_18[2] = __pyx_t_12;
          __pyx_t_18[3] = __pyx_mstate_global->__pyx_kp_u__8;
          __pyx_t_18[4] = __pyx_v_hzstr;
          __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_18, 5, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_22) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_hzstr), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_22) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_hzstr));
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1181, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF_SET(__pyx_v_mode_name, ((PyObject*)__pyx_t_5));
          __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1182
 *                             hzstr = hzstr.rstrip("0").rstrip(".")
 *                         mode_name = f"{width}x{height}@{hzstr}"
 *                         log("calculating mode %r", mode_name)             # <<<<<<<<<<<<<<
 *                         match_mode = self.calculate_mode(mode_name, width, height, hz)
 *                         assert match_mode, "no mode to match"
*/
          __pyx_t_12 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1182, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_22))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_22);
            assert(__pyx_t_12);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_22);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_22, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_calculating_mode_r, __pyx_v_mode_name};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1182, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1183
 *                         mode_name = f"{width}x{height}@{hzstr}"
 *                         log("calculating mode %r", mode_name)
 *                         match_mode = self.calculate_mode(mode_name, width, height, hz)             # <<<<<<<<<<<<<<
 *                         assert match_mode, "no mode to match"
 *                         #find an existing mode matching this resolution + vrefresh:
*/
          __pyx_t_27 = __Pyx_PyLong_As_unsigned_int(__pyx_v_width); if (unlikely((__pyx_t_27 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1183, __pyx_L25_error)
          __pyx_t_28 = __Pyx_PyLong_As_unsigned_int(__pyx_v_height); if (unlikely((__pyx_t_28 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1183, __pyx_L25_error)
          __pyx_t_29 = __Pyx_PyFloat_AsDouble(__pyx_v_hz); if (unlikely((__pyx_t_29 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1183, __pyx_L25_error)
          __pyx_v_match_mode = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->calculate_mode(__pyx_v_self, __pyx_v_mode_name, __pyx_t_27, __pyx_t_28, __pyx_t_29);

          /* "xpra/x11/bindings/randr.pyx":1184
 *                         log("calculating mode %r", mode_name)
 *                         match_mode = self.calculate_mode(mode_name, width, height, hz)
 *                         assert match_mode, "no mode to match"             # <<<<<<<<<<<<<<
 *                         #find an existing mode matching this resolution + vrefresh:
 *                         for j in range(output_info.nmode):
*/
          #ifndef CYTHON_WITHOUT_ASSERTIONS
          if (unlikely(__pyx_assertions_enabled())) {
            __pyx_t_17 = (__pyx_v_match_mode != 0);
            if (unlikely(!__pyx_t_17)) {
              __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_no_mode_to_match, 0, 0);
              __PYX_ERR(0, 1184, __pyx_L25_error)
            }
          }
          #else
          if ((1)); else __PYX_ERR(0, 1184, __pyx_L25_error)
          #endif

          /* "xpra/x11/bindings/randr.pyx":1186
 *                         assert match_mode, "no mode to match"
 *                         #find an existing mode matching this resolution + vrefresh:
 *                         for j in range(output_info.nmode):             # <<<<<<<<<<<<<<
 *                             #find this exact RRMode in the screen modes info:
 *                             for k in range(rsc.nmode):
*/
          __pyx_t_10 = __pyx_v_output_info->nmode;
          __pyx_t_11 = __pyx_t_10;
          for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_11; __pyx_t_30+=1) {
            __pyx_v_j = __pyx_t_30;

            /* "xpra/x11/bindings/randr.pyx":1188
 *                         for j in range(output_info.nmode):
 *                             #find this exact RRMode in the screen modes info:
 *                             for k in range(rsc.nmode):             # <<<<<<<<<<<<<<
 *                                 if (
 *                                     rsc.modes[k].id==output_info.modes[j] and
*/
            __pyx_t_31 = __pyx_v_rsc->nmode;
            __pyx_t_32 = __pyx_t_31;
            for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
              __pyx_v_k = __pyx_t_33;

              /* "xpra/x11/bindings/randr.pyx":1190
 *                             for k in range(rsc.nmode):
 *                                 if (
 *                                     rsc.modes[k].id==output_info.modes[j] and             # <<<<<<<<<<<<<<
 *                                     rsc.modes[k].width==match_mode.width and
 *                                     rsc.modes[k].height==match_mode.height and
*/
              __pyx_t_25 = ((__pyx_v_rsc->modes[__pyx_v_k]).id == (__pyx_v_output_info->modes[__pyx_v_j]));
              if (__pyx_t_25) {
              } else {
                __pyx_t_17 = __pyx_t_25;
                goto __pyx_L44_bool_binop_done;
              }

              /* "xpra/x11/bindings/randr.pyx":1191
 *                                 if (
 *                                     rsc.modes[k].id==output_info.modes[j] and
 *                                     rsc.modes[k].width==match_mode.width and             # <<<<<<<<<<<<<<
 *                                     rsc.modes[k].height==match_mode.height and
 *                                     rsc.modes[k].dotClock==match_mode.dotClock
*/
              __pyx_t_25 = ((__pyx_v_rsc->modes[__pyx_v_k]).width == __pyx_v_match_mode->width);
              if (__pyx_t_25) {
              } else {
                __pyx_t_17 = __pyx_t_25;
                goto __pyx_L44_bool_binop_done;
              }

              /* "xpra/x11/bindings/randr.pyx":1192
 *                                     rsc.modes[k].id==output_info.modes[j] and
 *                                     rsc.modes[k].width==match_mode.width and
 *                                     rsc.modes[k].height==match_mode.height and             # <<<<<<<<<<<<<<
 *                                     rsc.modes[k].dotClock==match_mode.dotClock
 *                                     ):
*/
              __pyx_t_25 = ((__pyx_v_rsc->modes[__pyx_v_k]).height == __pyx_v_match_mode->height);
              if (__pyx_t_25) {
              } else {
                __pyx_t_17 = __pyx_t_25;
                goto __pyx_L44_bool_binop_done;
              }

              /* "xpra/x11/bindings/randr.pyx":1193
 *                                     rsc.modes[k].width==match_mode.width and
 *                                     rsc.modes[k].height==match_mode.height and
 *                                     rsc.modes[k].dotClock==match_mode.dotClock             # <<<<<<<<<<<<<<
 *                                     ):
 *                                     mode = output_info.modes[j]
*/
              __pyx_t_25 = ((__pyx_v_rsc->modes[__pyx_v_k]).dotClock == __pyx_v_match_mode->dotClock);
              __pyx_t_17 = __pyx_t_25;
              __pyx_L44_bool_binop_done:;

              /* "xpra/x11/bindings/randr.pyx":1189
 *                             #find this exact RRMode in the screen modes info:
 *                             for k in range(rsc.nmode):
 *                                 if (             # <<<<<<<<<<<<<<
 *                                     rsc.modes[k].id==output_info.modes[j] and
 *                                     rsc.modes[k].width==match_mode.width and
*/
              if (__pyx_t_17) {

                /* "xpra/x11/bindings/randr.pyx":1195
 *                                     rsc.modes[k].dotClock==match_mode.dotClock
 *                                     ):
 *                                     mode = output_info.modes[j]             # <<<<<<<<<<<<<<
 *                                     mode_name = s(rsc.modes[j].name)
 *                                     log("using existing output mode %r (%#x) for %ix%i",
*/
                __pyx_v_mode = (__pyx_v_output_info->modes[__pyx_v_j]);

                /* "xpra/x11/bindings/randr.pyx":1196
 *                                     ):
 *                                     mode = output_info.modes[j]
 *                                     mode_name = s(rsc.modes[j].name)             # <<<<<<<<<<<<<<
 *                                     log("using existing output mode %r (%#x) for %ix%i",
 *                                         mode_name, mode, width, height)
*/
                __pyx_t_5 = __pyx_f_4xpra_3x11_8bindings_5randr_s((__pyx_v_rsc->modes[__pyx_v_j]).name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF_SET(__pyx_v_mode_name, ((PyObject*)__pyx_t_5));
                __pyx_t_5 = 0;

                /* "xpra/x11/bindings/randr.pyx":1197
 *                                     mode = output_info.modes[j]
 *                                     mode_name = s(rsc.modes[j].name)
 *                                     log("using existing output mode %r (%#x) for %ix%i",             # <<<<<<<<<<<<<<
 *                                         mode_name, mode, width, height)
 *                                     break
*/
                __pyx_t_22 = NULL;
                __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1197, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_12);

                /* "xpra/x11/bindings/randr.pyx":1198
 *                                     mode_name = s(rsc.modes[j].name)
 *                                     log("using existing output mode %r (%#x) for %ix%i",
 *                                         mode_name, mode, width, height)             # <<<<<<<<<<<<<<
 *                                     break
 *                             if mode:
*/
                __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1198, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_3 = 1;
                #if CYTHON_UNPACK_METHODS
                if (unlikely(PyMethod_Check(__pyx_t_12))) {
                  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_12);
                  assert(__pyx_t_22);
                  PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
                  __Pyx_INCREF(__pyx_t_22);
                  __Pyx_INCREF(__pyx__function);
                  __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
                  __pyx_t_3 = 0;
                }
                #endif
                {
                  PyObject *__pyx_callargs[6] = {__pyx_t_22, __pyx_mstate_global->__pyx_kp_u_using_existing_output_mode_r_x_f, __pyx_v_mode_name, __pyx_t_2, __pyx_v_width, __pyx_v_height};
                  __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (6-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
                  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1197, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                }
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                /* "xpra/x11/bindings/randr.pyx":1199
 *                                     log("using existing output mode %r (%#x) for %ix%i",
 *                                         mode_name, mode, width, height)
 *                                     break             # <<<<<<<<<<<<<<
 *                             if mode:
 *                                 break
*/
                goto __pyx_L42_break;

                /* "xpra/x11/bindings/randr.pyx":1189
 *                             #find this exact RRMode in the screen modes info:
 *                             for k in range(rsc.nmode):
 *                                 if (             # <<<<<<<<<<<<<<
 *                                     rsc.modes[k].id==output_info.modes[j] and
 *                                     rsc.modes[k].width==match_mode.width and
*/
              }
            }
            __pyx_L42_break:;

            /* "xpra/x11/bindings/randr.pyx":1200
 *                                         mode_name, mode, width, height)
 *                                     break
 *                             if mode:             # <<<<<<<<<<<<<<
 *                                 break
 *                         if not mode:
*/
            __pyx_t_17 = (__pyx_v_mode != 0);
            if (__pyx_t_17) {

              /* "xpra/x11/bindings/randr.pyx":1201
 *                                     break
 *                             if mode:
 *                                 break             # <<<<<<<<<<<<<<
 *                         if not mode:
 *                             #try to find a screen mode not added to this output yet:
*/
              goto __pyx_L40_break;

              /* "xpra/x11/bindings/randr.pyx":1200
 *                                         mode_name, mode, width, height)
 *                                     break
 *                             if mode:             # <<<<<<<<<<<<<<
 *                                 break
 *                         if not mode:
*/
            }
          }
          __pyx_L40_break:;

          /* "xpra/x11/bindings/randr.pyx":1202
 *                             if mode:
 *                                 break
 *                         if not mode:             # <<<<<<<<<<<<<<
 *                             #try to find a screen mode not added to this output yet:
 *                             for j in range(rsc.nmode):
*/
          __pyx_t_17 = (!(__pyx_v_mode != 0));
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1204
 *                         if not mode:
 *                             #try to find a screen mode not added to this output yet:
 *                             for j in range(rsc.nmode):             # <<<<<<<<<<<<<<
 *                                 if (
 *                                     rsc.modes[j].width==match_mode.width and
*/
            __pyx_t_10 = __pyx_v_rsc->nmode;
            __pyx_t_11 = __pyx_t_10;
            for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_11; __pyx_t_30+=1) {
              __pyx_v_j = __pyx_t_30;

              /* "xpra/x11/bindings/randr.pyx":1206
 *                             for j in range(rsc.nmode):
 *                                 if (
 *                                     rsc.modes[j].width==match_mode.width and             # <<<<<<<<<<<<<<
 *                                     rsc.modes[j].height==match_mode.height and
 *                                     rsc.modes[j].dotClock==match_mode.dotClock
*/
              __pyx_t_25 = ((__pyx_v_rsc->modes[__pyx_v_j]).width == __pyx_v_match_mode->width);
              if (__pyx_t_25) {
              } else {
                __pyx_t_17 = __pyx_t_25;
                goto __pyx_L53_bool_binop_done;
              }

              /* "xpra/x11/bindings/randr.pyx":1207
 *                                 if (
 *                                     rsc.modes[j].width==match_mode.width and
 *                                     rsc.modes[j].height==match_mode.height and             # <<<<<<<<<<<<<<
 *                                     rsc.modes[j].dotClock==match_mode.dotClock
 *                                     ):
*/
              __pyx_t_25 = ((__pyx_v_rsc->modes[__pyx_v_j]).height == __pyx_v_match_mode->height);
              if (__pyx_t_25) {
              } else {
                __pyx_t_17 = __pyx_t_25;
                goto __pyx_L53_bool_binop_done;
              }

              /* "xpra/x11/bindings/randr.pyx":1208
 *                                     rsc.modes[j].width==match_mode.width and
 *                                     rsc.modes[j].height==match_mode.height and
 *                                     rsc.modes[j].dotClock==match_mode.dotClock             # <<<<<<<<<<<<<<
 *                                     ):
 *                                     mode = rsc.modes[j].id
*/
              __pyx_t_25 = ((__pyx_v_rsc->modes[__pyx_v_j]).dotClock == __pyx_v_match_mode->dotClock);
              __pyx_t_17 = __pyx_t_25;
              __pyx_L53_bool_binop_done:;

              /* "xpra/x11/bindings/randr.pyx":1205
 *                             #try to find a screen mode not added to this output yet:
 *                             for j in range(rsc.nmode):
 *                                 if (             # <<<<<<<<<<<<<<
 *                                     rsc.modes[j].width==match_mode.width and
 *                                     rsc.modes[j].height==match_mode.height and
*/
              if (__pyx_t_17) {

                /* "xpra/x11/bindings/randr.pyx":1210
 *                                     rsc.modes[j].dotClock==match_mode.dotClock
 *                                     ):
 *                                     mode = rsc.modes[j].id             # <<<<<<<<<<<<<<
 *                                     mode_name = s(rsc.modes[j].name)
 *                                     log(f"using screen mode {mode_name!r} ({mode:#x}) for {width}x{height}")
*/
                __pyx_t_34 = (__pyx_v_rsc->modes[__pyx_v_j]).id;
                __pyx_v_mode = __pyx_t_34;

                /* "xpra/x11/bindings/randr.pyx":1211
 *                                     ):
 *                                     mode = rsc.modes[j].id
 *                                     mode_name = s(rsc.modes[j].name)             # <<<<<<<<<<<<<<
 *                                     log(f"using screen mode {mode_name!r} ({mode:#x}) for {width}x{height}")
 *                                     break
*/
                __pyx_t_5 = __pyx_f_4xpra_3x11_8bindings_5randr_s((__pyx_v_rsc->modes[__pyx_v_j]).name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1211, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF_SET(__pyx_v_mode_name, ((PyObject*)__pyx_t_5));
                __pyx_t_5 = 0;

                /* "xpra/x11/bindings/randr.pyx":1212
 *                                     mode = rsc.modes[j].id
 *                                     mode_name = s(rsc.modes[j].name)
 *                                     log(f"using screen mode {mode_name!r} ({mode:#x}) for {width}x{height}")             # <<<<<<<<<<<<<<
 *                                     break
 *                             if not mode:
*/
                __pyx_t_12 = NULL;
                __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_22 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_mode_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1212, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_22);
                __pyx_t_4 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_4);
                __pyx_t_20 = __Pyx_PyObject_Format(__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_x_2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1212, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_20);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_width, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_4);
                __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_v_height, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1212, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_13);
                __pyx_t_35[0] = __pyx_mstate_global->__pyx_kp_u_using_screen_mode;
                __pyx_t_35[1] = __pyx_t_22;
                __pyx_t_35[2] = __pyx_mstate_global->__pyx_kp_u__9;
                __pyx_t_35[3] = __pyx_t_20;
                __pyx_t_35[4] = __pyx_mstate_global->__pyx_kp_u_for;
                __pyx_t_35[5] = __pyx_t_4;
                __pyx_t_35[6] = __pyx_mstate_global->__pyx_n_u_x;
                __pyx_t_35[7] = __pyx_t_13;
                __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_35, 8, 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_22) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_22) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1212, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_7);
                __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
                __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __pyx_t_3 = 1;
                #if CYTHON_UNPACK_METHODS
                if (unlikely(PyMethod_Check(__pyx_t_2))) {
                  __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
                  assert(__pyx_t_12);
                  PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
                  __Pyx_INCREF(__pyx_t_12);
                  __Pyx_INCREF(__pyx__function);
                  __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
                  __pyx_t_3 = 0;
                }
                #endif
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_7};
                  __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1212, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                }
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                /* "xpra/x11/bindings/randr.pyx":1213
 *                                     mode_name = s(rsc.modes[j].name)
 *                                     log(f"using screen mode {mode_name!r} ({mode:#x}) for {width}x{height}")
 *                                     break             # <<<<<<<<<<<<<<
 *                             if not mode:
 *                                 #may have already been added:
*/
                goto __pyx_L51_break;

                /* "xpra/x11/bindings/randr.pyx":1205
 *                             #try to find a screen mode not added to this output yet:
 *                             for j in range(rsc.nmode):
 *                                 if (             # <<<<<<<<<<<<<<
 *                                     rsc.modes[j].width==match_mode.width and
 *                                     rsc.modes[j].height==match_mode.height and
*/
              }
            }
            __pyx_L51_break:;

            /* "xpra/x11/bindings/randr.pyx":1214
 *                                     log(f"using screen mode {mode_name!r} ({mode:#x}) for {width}x{height}")
 *                                     break
 *                             if not mode:             # <<<<<<<<<<<<<<
 *                                 #may have already been added:
 *                                 mode = new_modes.get(mode_name, 0)
*/
            __pyx_t_17 = (!(__pyx_v_mode != 0));
            if (__pyx_t_17) {

              /* "xpra/x11/bindings/randr.pyx":1216
 *                             if not mode:
 *                                 #may have already been added:
 *                                 mode = new_modes.get(mode_name, 0)             # <<<<<<<<<<<<<<
 *                                 if not mode:
 *                                     mode = self.add_screen_mode(mode_name, width, height, hz)
*/
              __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_new_modes, __pyx_v_mode_name, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1216, __pyx_L25_error)
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_34 = __Pyx_PyLong_As_unsigned_long(__pyx_t_5); if (unlikely((__pyx_t_34 == ((RRMode)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1216, __pyx_L25_error)
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __pyx_v_mode = __pyx_t_34;

              /* "xpra/x11/bindings/randr.pyx":1217
 *                                 #may have already been added:
 *                                 mode = new_modes.get(mode_name, 0)
 *                                 if not mode:             # <<<<<<<<<<<<<<
 *                                     mode = self.add_screen_mode(mode_name, width, height, hz)
 *                                     if not mode:
*/
              __pyx_t_17 = (!(__pyx_v_mode != 0));
              if (__pyx_t_17) {

                /* "xpra/x11/bindings/randr.pyx":1218
 *                                 mode = new_modes.get(mode_name, 0)
 *                                 if not mode:
 *                                     mode = self.add_screen_mode(mode_name, width, height, hz)             # <<<<<<<<<<<<<<
 *                                     if not mode:
 *                                         log.error("Error: failed to add mode %r to output %i", mode_name, i)
*/
                __pyx_t_28 = __Pyx_PyLong_As_unsigned_int(__pyx_v_width); if (unlikely((__pyx_t_28 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1218, __pyx_L25_error)
                __pyx_t_27 = __Pyx_PyLong_As_unsigned_int(__pyx_v_height); if (unlikely((__pyx_t_27 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1218, __pyx_L25_error)
                __pyx_t_29 = __Pyx_PyFloat_AsDouble(__pyx_v_hz); if (unlikely((__pyx_t_29 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1218, __pyx_L25_error)
                __pyx_t_34 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->add_screen_mode(__pyx_v_self, __pyx_v_mode_name, __pyx_t_28, __pyx_t_27, __pyx_t_29); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1218, __pyx_L25_error)
                __pyx_v_mode = __pyx_t_34;

                /* "xpra/x11/bindings/randr.pyx":1219
 *                                 if not mode:
 *                                     mode = self.add_screen_mode(mode_name, width, height, hz)
 *                                     if not mode:             # <<<<<<<<<<<<<<
 *                                         log.error("Error: failed to add mode %r to output %i", mode_name, i)
 *                                         continue
*/
                __pyx_t_17 = (!(__pyx_v_mode != 0));
                if (__pyx_t_17) {

                  /* "xpra/x11/bindings/randr.pyx":1220
 *                                     mode = self.add_screen_mode(mode_name, width, height, hz)
 *                                     if not mode:
 *                                         log.error("Error: failed to add mode %r to output %i", mode_name, i)             # <<<<<<<<<<<<<<
 *                                         continue
 *                                     else:
*/
                  __pyx_t_2 = NULL;
                  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1220, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_7);
                  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1220, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                  __pyx_t_3 = 1;
                  #if CYTHON_UNPACK_METHODS
                  if (unlikely(PyMethod_Check(__pyx_t_12))) {
                    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12);
                    assert(__pyx_t_2);
                    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
                    __Pyx_INCREF(__pyx_t_2);
                    __Pyx_INCREF(__pyx__function);
                    __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
                    __pyx_t_3 = 0;
                  }
                  #endif
                  {
                    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_add_mode_r_to_ou, __pyx_v_mode_name, __pyx_v_i};
                    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1220, __pyx_L25_error)
                    __Pyx_GOTREF(__pyx_t_5);
                  }
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                  /* "xpra/x11/bindings/randr.pyx":1221
 *                                     if not mode:
 *                                         log.error("Error: failed to add mode %r to output %i", mode_name, i)
 *                                         continue             # <<<<<<<<<<<<<<
 *                                     else:
 *                                         new_modes[mode_name] = mode
*/
                  goto __pyx_L22_continue;

                  /* "xpra/x11/bindings/randr.pyx":1219
 *                                 if not mode:
 *                                     mode = self.add_screen_mode(mode_name, width, height, hz)
 *                                     if not mode:             # <<<<<<<<<<<<<<
 *                                         log.error("Error: failed to add mode %r to output %i", mode_name, i)
 *                                         continue
*/
                }

                /* "xpra/x11/bindings/randr.pyx":1223
 *                                         continue
 *                                     else:
 *                                         new_modes[mode_name] = mode             # <<<<<<<<<<<<<<
 *                             assert mode!=0, f"mode {width}x{height}@{hz} not found"
 *                             XRRAddOutputMode(self.display, output, mode)
*/
                /*else*/ {
                  __pyx_t_5 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1223, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  if (unlikely((PyDict_SetItem(__pyx_v_new_modes, __pyx_v_mode_name, __pyx_t_5) < 0))) __PYX_ERR(0, 1223, __pyx_L25_error)
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                }

                /* "xpra/x11/bindings/randr.pyx":1217
 *                                 #may have already been added:
 *                                 mode = new_modes.get(mode_name, 0)
 *                                 if not mode:             # <<<<<<<<<<<<<<
 *                                     mode = self.add_screen_mode(mode_name, width, height, hz)
 *                                     if not mode:
*/
              }

              /* "xpra/x11/bindings/randr.pyx":1214
 *                                     log(f"using screen mode {mode_name!r} ({mode:#x}) for {width}x{height}")
 *                                     break
 *                             if not mode:             # <<<<<<<<<<<<<<
 *                                 #may have already been added:
 *                                 mode = new_modes.get(mode_name, 0)
*/
            }

            /* "xpra/x11/bindings/randr.pyx":1224
 *                                     else:
 *                                         new_modes[mode_name] = mode
 *                             assert mode!=0, f"mode {width}x{height}@{hz} not found"             # <<<<<<<<<<<<<<
 *                             XRRAddOutputMode(self.display, output, mode)
 *                             log(f"mode {mode_name!r} ({mode:#x}) added to output {i} ({output})")
*/
            #ifndef CYTHON_WITHOUT_ASSERTIONS
            if (unlikely(__pyx_assertions_enabled())) {
              __pyx_t_17 = (__pyx_v_mode != 0);
              if (unlikely(!__pyx_t_17)) {
                __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_width, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1224, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_5);
                __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_height, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1224, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_12);
                __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_hz, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_21[0] = __pyx_mstate_global->__pyx_kp_u_mode_2;
                __pyx_t_21[1] = __pyx_t_5;
                __pyx_t_21[2] = __pyx_mstate_global->__pyx_n_u_x;
                __pyx_t_21[3] = __pyx_t_12;
                __pyx_t_21[4] = __pyx_mstate_global->__pyx_kp_u__8;
                __pyx_t_21[5] = __pyx_t_2;
                __pyx_t_21[6] = __pyx_mstate_global->__pyx_kp_u_not_found_2;
                __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_21, 7, 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 10, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1224, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_7);
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_7, 0, 0);
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                __PYX_ERR(0, 1224, __pyx_L25_error)
              }
            }
            #else
            if ((1)); else __PYX_ERR(0, 1224, __pyx_L25_error)
            #endif

            /* "xpra/x11/bindings/randr.pyx":1225
 *                                         new_modes[mode_name] = mode
 *                             assert mode!=0, f"mode {width}x{height}@{hz} not found"
 *                             XRRAddOutputMode(self.display, output, mode)             # <<<<<<<<<<<<<<
 *                             log(f"mode {mode_name!r} ({mode:#x}) added to output {i} ({output})")
 *                         XRRFreeModeInfo(match_mode)
*/
            XRRAddOutputMode(__pyx_v_self->__pyx_base.display, __pyx_v_output, __pyx_v_mode);

            /* "xpra/x11/bindings/randr.pyx":1226
 *                             assert mode!=0, f"mode {width}x{height}@{hz} not found"
 *                             XRRAddOutputMode(self.display, output, mode)
 *                             log(f"mode {mode_name!r} ({mode:#x}) added to output {i} ({output})")             # <<<<<<<<<<<<<<
 *                         XRRFreeModeInfo(match_mode)
 *                     else:
*/
            __pyx_t_2 = NULL;
            __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1226, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_mode_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1226, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_13 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1226, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_x_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1226, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1226, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_20 = __Pyx_PyUnicode_From_RROutput(__pyx_v_output, 0, ' ', 'd'); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1226, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_20);
            __pyx_t_36[0] = __pyx_mstate_global->__pyx_kp_u_mode_2;
            __pyx_t_36[1] = __pyx_t_5;
            __pyx_t_36[2] = __pyx_mstate_global->__pyx_kp_u__9;
            __pyx_t_36[3] = __pyx_t_4;
            __pyx_t_36[4] = __pyx_mstate_global->__pyx_kp_u_added_to_output;
            __pyx_t_36[5] = __pyx_t_13;
            __pyx_t_36[6] = __pyx_mstate_global->__pyx_kp_u__9;
            __pyx_t_36[7] = __pyx_t_20;
            __pyx_t_36[8] = __pyx_mstate_global->__pyx_kp_u__5;
            __pyx_t_22 = __Pyx_PyUnicode_Join(__pyx_t_36, 9, 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
            if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1226, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_22);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_3 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_12))) {
              __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12);
              assert(__pyx_t_2);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
              __pyx_t_3 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_22};
              __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1226, __pyx_L25_error)
              __Pyx_GOTREF(__pyx_t_7);
            }
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "xpra/x11/bindings/randr.pyx":1202
 *                             if mode:
 *                                 break
 *                         if not mode:             # <<<<<<<<<<<<<<
 *                             #try to find a screen mode not added to this output yet:
 *                             for j in range(rsc.nmode):
*/
          }

          /* "xpra/x11/bindings/randr.pyx":1227
 *                             XRRAddOutputMode(self.display, output, mode)
 *                             log(f"mode {mode_name!r} ({mode:#x}) added to output {i} ({output})")
 *                         XRRFreeModeInfo(match_mode)             # <<<<<<<<<<<<<<
 *                     else:
 *                         noutput = 0
*/
          XRRFreeModeInfo(__pyx_v_match_mode);

          /* "xpra/x11/bindings/randr.pyx":1167
 *                     hz = 60.0
 *                     x, y, width, height = 0, 0, 1024, 768
 *                     if m:             # <<<<<<<<<<<<<<
 *                         if m.get("primary", False):
 *                             primary = i
*/
          goto __pyx_L32;
        }

        /* "xpra/x11/bindings/randr.pyx":1229
 *                         XRRFreeModeInfo(match_mode)
 *                     else:
 *                         noutput = 0             # <<<<<<<<<<<<<<
 * 
 *                     rotation_int = m.get("rotation", 0)
*/
        /*else*/ {
          __pyx_v_noutput = 0;
        }
        __pyx_L32:;

        /* "xpra/x11/bindings/randr.pyx":1231
 *                         noutput = 0
 * 
 *                     rotation_int = m.get("rotation", 0)             # <<<<<<<<<<<<<<
 *                     rotation = ROTATION_CONST.get(rotation_int, RR_Rotate_0)
 * 
*/
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1231, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[6], NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1231, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_rotation_int, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1232
 * 
 *                     rotation_int = m.get("rotation", 0)
 *                     rotation = ROTATION_CONST.get(rotation_int, RR_Rotate_0)             # <<<<<<<<<<<<<<
 * 
 *                     log("XRRSetCrtcConfig(%#x, %#x, %i, %i, %i, %i, %i, %i, %#x, %i)",
*/
        __pyx_t_7 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_ROTATION_CONST); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1232, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1232, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __pyx_t_22 = __Pyx_PyLong_From_Rotation(RR_Rotate_0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1232, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
          assert(__pyx_t_7);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_rotation_int, __pyx_t_22};
          __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1232, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_XDECREF_SET(__pyx_v_rotation, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1234
 *                     rotation = ROTATION_CONST.get(rotation_int, RR_Rotate_0)
 * 
 *                     log("XRRSetCrtcConfig(%#x, %#x, %i, %i, %i, %i, %i, %i, %#x, %i)",             # <<<<<<<<<<<<<<
 *                             <uintptr_t> self.display, <uintptr_t> rsc, crtc,
 *                             CurrentTime, x, y, mode, rotation, <uintptr_t> &output, noutput)
*/
        __pyx_t_2 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1234, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_22);

        /* "xpra/x11/bindings/randr.pyx":1235
 * 
 *                     log("XRRSetCrtcConfig(%#x, %#x, %i, %i, %i, %i, %i, %i, %#x, %i)",
 *                             <uintptr_t> self.display, <uintptr_t> rsc, crtc,             # <<<<<<<<<<<<<<
 *                             CurrentTime, x, y, mode, rotation, <uintptr_t> &output, noutput)
 *                     r = XRRSetCrtcConfig(self.display, rsc, crtc,
*/
        __pyx_t_7 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_self->__pyx_base.display)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1235, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_20 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_rsc)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1235, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_13 = __Pyx_PyLong_From_unsigned_long(__pyx_v_crtc); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1235, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_13);

        /* "xpra/x11/bindings/randr.pyx":1236
 *                     log("XRRSetCrtcConfig(%#x, %#x, %i, %i, %i, %i, %i, %i, %#x, %i)",
 *                             <uintptr_t> self.display, <uintptr_t> rsc, crtc,
 *                             CurrentTime, x, y, mode, rotation, <uintptr_t> &output, noutput)             # <<<<<<<<<<<<<<
 *                     r = XRRSetCrtcConfig(self.display, rsc, crtc,
 *                           CurrentTime, x, y, mode,
*/
        __pyx_t_4 = __Pyx_PyLong_From_int(CurrentTime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1236, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyLong_From_unsigned_long(__pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1236, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_37 = __Pyx_PyLong_FromSize_t(((uintptr_t)(&__pyx_v_output))); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1236, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_37);
        __pyx_t_38 = __Pyx_PyLong_From_long(__pyx_v_noutput); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1236, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_38);
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_22))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_22);
          assert(__pyx_t_2);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_22);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_22, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[12] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_XRRSetCrtcConfig_x_x_i_i_i_i_i_i, __pyx_t_7, __pyx_t_20, __pyx_t_13, __pyx_t_4, __pyx_v_x, __pyx_v_y, __pyx_t_5, __pyx_v_rotation, __pyx_t_37, __pyx_t_38};
          __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_3, (12-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
          __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1234, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1238
 *                             CurrentTime, x, y, mode, rotation, <uintptr_t> &output, noutput)
 *                     r = XRRSetCrtcConfig(self.display, rsc, crtc,
 *                           CurrentTime, x, y, mode,             # <<<<<<<<<<<<<<
 *                           rotation, &output, noutput)
 *                     if r:
*/
        __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_x); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1238, __pyx_L25_error)
        __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_y); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1238, __pyx_L25_error)

        /* "xpra/x11/bindings/randr.pyx":1239
 *                     r = XRRSetCrtcConfig(self.display, rsc, crtc,
 *                           CurrentTime, x, y, mode,
 *                           rotation, &output, noutput)             # <<<<<<<<<<<<<<
 *                     if r:
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")
*/
        __pyx_t_39 = __Pyx_PyLong_As_Rotation(__pyx_v_rotation); if (unlikely((__pyx_t_39 == ((Rotation)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L25_error)

        /* "xpra/x11/bindings/randr.pyx":1237
 *                             <uintptr_t> self.display, <uintptr_t> rsc, crtc,
 *                             CurrentTime, x, y, mode, rotation, <uintptr_t> &output, noutput)
 *                     r = XRRSetCrtcConfig(self.display, rsc, crtc,             # <<<<<<<<<<<<<<
 *                           CurrentTime, x, y, mode,
 *                           rotation, &output, noutput)
*/
        __pyx_v_r = XRRSetCrtcConfig(__pyx_v_self->__pyx_base.display, __pyx_v_rsc, __pyx_v_crtc, CurrentTime, __pyx_t_10, __pyx_t_11, __pyx_v_mode, __pyx_t_39, (&__pyx_v_output), __pyx_v_noutput);

        /* "xpra/x11/bindings/randr.pyx":1240
 *                           CurrentTime, x, y, mode,
 *                           rotation, &output, noutput)
 *                     if r:             # <<<<<<<<<<<<<<
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")
 *                     mmw = m.get("width-mm", 0) or dpi96(width)
*/
        __pyx_t_17 = (__pyx_v_r != 0);
        if (unlikely(__pyx_t_17)) {

          /* "xpra/x11/bindings/randr.pyx":1241
 *                           rotation, &output, noutput)
 *                     if r:
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")             # <<<<<<<<<<<<<<
 *                     mmw = m.get("width-mm", 0) or dpi96(width)
 *                     mmh = m.get("height-mm", 0) or dpi96(height)
*/
          __pyx_t_22 = NULL;
          __pyx_t_38 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1241, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_38);
          __pyx_t_37 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_failed_to_set_crtc_config_for_mo, __pyx_t_38); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1241, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_37);
          __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
          __pyx_t_3 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_37};
            __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
            __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1241, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
          }
          __Pyx_Raise(__pyx_t_12, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __PYX_ERR(0, 1241, __pyx_L25_error)

          /* "xpra/x11/bindings/randr.pyx":1240
 *                           CurrentTime, x, y, mode,
 *                           rotation, &output, noutput)
 *                     if r:             # <<<<<<<<<<<<<<
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")
 *                     mmw = m.get("width-mm", 0) or dpi96(width)
*/
        }

        /* "xpra/x11/bindings/randr.pyx":1242
 *                     if r:
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")
 *                     mmw = m.get("width-mm", 0) or dpi96(width)             # <<<<<<<<<<<<<<
 *                     mmh = m.get("height-mm", 0) or dpi96(height)
 *                     self.set_output_int_property(i, "WIDTH_MM", mmw)
*/
        __pyx_t_37 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1242, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_37);
        __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_37, __pyx_mstate_global->__pyx_tuple[7], NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1242, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1242, __pyx_L25_error)
        if (!__pyx_t_17) {
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_22);
          __pyx_t_12 = __pyx_t_22;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          goto __pyx_L60_bool_binop_done;
        }
        __pyx_t_22 = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(__pyx_v_dpi96, __pyx_v_width); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1242, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_INCREF(__pyx_t_22);
        __pyx_t_12 = __pyx_t_22;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __pyx_L60_bool_binop_done:;
        __Pyx_XDECREF_SET(__pyx_v_mmw, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1243
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")
 *                     mmw = m.get("width-mm", 0) or dpi96(width)
 *                     mmh = m.get("height-mm", 0) or dpi96(height)             # <<<<<<<<<<<<<<
 *                     self.set_output_int_property(i, "WIDTH_MM", mmw)
 *                     self.set_output_int_property(i, "HEIGHT_MM", mmh)
*/
        __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1243, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_37 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[8], NULL); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1243, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_37);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_37); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1243, __pyx_L25_error)
        if (!__pyx_t_17) {
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_37);
          __pyx_t_12 = __pyx_t_37;
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
          goto __pyx_L62_bool_binop_done;
        }
        __pyx_t_37 = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(__pyx_v_dpi96, __pyx_v_height); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1243, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_37);
        __Pyx_INCREF(__pyx_t_37);
        __pyx_t_12 = __pyx_t_37;
        __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
        __pyx_L62_bool_binop_done:;
        __Pyx_XDECREF_SET(__pyx_v_mmh, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1244
 *                     mmw = m.get("width-mm", 0) or dpi96(width)
 *                     mmh = m.get("height-mm", 0) or dpi96(height)
 *                     self.set_output_int_property(i, "WIDTH_MM", mmw)             # <<<<<<<<<<<<<<
 *                     self.set_output_int_property(i, "HEIGHT_MM", mmh)
 *                     #this allows us to disconnect the output of this crtc:
*/
        __pyx_t_37 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_37);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_37, __pyx_v_i, __pyx_mstate_global->__pyx_n_u_WIDTH_MM, __pyx_v_mmw};
          __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_output_int_property, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1244, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1245
 *                     mmh = m.get("height-mm", 0) or dpi96(height)
 *                     self.set_output_int_property(i, "WIDTH_MM", mmw)
 *                     self.set_output_int_property(i, "HEIGHT_MM", mmh)             # <<<<<<<<<<<<<<
 *                     #this allows us to disconnect the output of this crtc:
 *                     self.set_output_int_property(i, "SUSPENDED", not bool(m))
*/
        __pyx_t_37 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_37);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_37, __pyx_v_i, __pyx_mstate_global->__pyx_n_u_HEIGHT_MM, __pyx_v_mmh};
          __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_output_int_property, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1245, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1247
 *                     self.set_output_int_property(i, "HEIGHT_MM", mmh)
 *                     #this allows us to disconnect the output of this crtc:
 *                     self.set_output_int_property(i, "SUSPENDED", not bool(m))             # <<<<<<<<<<<<<<
 *                     if width==0 or height==0:
 *                         log.info(f"disabling dummy crtc and output {i}")
*/
        __pyx_t_37 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_37);
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_m); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1247, __pyx_L25_error)
        __pyx_t_22 = __Pyx_PyBool_FromLong((!(!(!__pyx_t_17)))); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1247, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_37, __pyx_v_i, __pyx_mstate_global->__pyx_n_u_SUSPENDED, __pyx_t_22};
          __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_output_int_property, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1247, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "xpra/x11/bindings/randr.pyx":1248
 *                     #this allows us to disconnect the output of this crtc:
 *                     self.set_output_int_property(i, "SUSPENDED", not bool(m))
 *                     if width==0 or height==0:             # <<<<<<<<<<<<<<
 *                         log.info(f"disabling dummy crtc and output {i}")
 *                     else:
*/
        __pyx_t_25 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_width, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_25 < 0))) __PYX_ERR(0, 1248, __pyx_L25_error)
        if (!__pyx_t_25) {
        } else {
          __pyx_t_17 = __pyx_t_25;
          goto __pyx_L65_bool_binop_done;
        }
        __pyx_t_25 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_height, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_25 < 0))) __PYX_ERR(0, 1248, __pyx_L25_error)
        __pyx_t_17 = __pyx_t_25;
        __pyx_L65_bool_binop_done:;
        if (__pyx_t_17) {

          /* "xpra/x11/bindings/randr.pyx":1249
 *                     self.set_output_int_property(i, "SUSPENDED", not bool(m))
 *                     if width==0 or height==0:
 *                         log.info(f"disabling dummy crtc and output {i}")             # <<<<<<<<<<<<<<
 *                     else:
 *                         posinfo = ""
*/
          __pyx_t_22 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1249, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_37);
          __pyx_t_38 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1249, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_38);
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
          __pyx_t_37 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1249, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_37);
          __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_disabling_dummy_crtc_and_output, __pyx_t_37); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1249, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_38))) {
            __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_38);
            assert(__pyx_t_22);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_38);
            __Pyx_INCREF(__pyx_t_22);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_38, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_5};
            __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_38, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1249, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "xpra/x11/bindings/randr.pyx":1248
 *                     #this allows us to disconnect the output of this crtc:
 *                     self.set_output_int_property(i, "SUSPENDED", not bool(m))
 *                     if width==0 or height==0:             # <<<<<<<<<<<<<<
 *                         log.info(f"disabling dummy crtc and output {i}")
 *                     else:
*/
          goto __pyx_L64;
        }

        /* "xpra/x11/bindings/randr.pyx":1251
 *                         log.info(f"disabling dummy crtc and output {i}")
 *                     else:
 *                         posinfo = ""             # <<<<<<<<<<<<<<
 *                         if x or y:
 *                             posinfo = " at %i,%i" % (x, y)
*/
        /*else*/ {
          __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_);
          __Pyx_XDECREF_SET(__pyx_v_posinfo, __pyx_mstate_global->__pyx_kp_u_);

          /* "xpra/x11/bindings/randr.pyx":1252
 *                     else:
 *                         posinfo = ""
 *                         if x or y:             # <<<<<<<<<<<<<<
 *                             posinfo = " at %i,%i" % (x, y)
 *                         dpiinfo = ""
*/
          __pyx_t_25 = __Pyx_PyObject_IsTrue(__pyx_v_x); if (unlikely((__pyx_t_25 < 0))) __PYX_ERR(0, 1252, __pyx_L25_error)
          if (!__pyx_t_25) {
          } else {
            __pyx_t_17 = __pyx_t_25;
            goto __pyx_L68_bool_binop_done;
          }
          __pyx_t_25 = __Pyx_PyObject_IsTrue(__pyx_v_y); if (unlikely((__pyx_t_25 < 0))) __PYX_ERR(0, 1252, __pyx_L25_error)
          __pyx_t_17 = __pyx_t_25;
          __pyx_L68_bool_binop_done:;
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1253
 *                         posinfo = ""
 *                         if x or y:
 *                             posinfo = " at %i,%i" % (x, y)             # <<<<<<<<<<<<<<
 *                         dpiinfo = ""
 *                         dpix = round(width * 25.4 / mmw)
*/
            __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1253, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_INCREF(__pyx_v_x);
            __Pyx_GIVEREF(__pyx_v_x);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1253, __pyx_L25_error);
            __Pyx_INCREF(__pyx_v_y);
            __Pyx_GIVEREF(__pyx_v_y);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1253, __pyx_L25_error);
            __pyx_t_38 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_at_i_i, __pyx_t_12); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1253, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_38);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF_SET(__pyx_v_posinfo, ((PyObject*)__pyx_t_38));
            __pyx_t_38 = 0;

            /* "xpra/x11/bindings/randr.pyx":1252
 *                     else:
 *                         posinfo = ""
 *                         if x or y:             # <<<<<<<<<<<<<<
 *                             posinfo = " at %i,%i" % (x, y)
 *                         dpiinfo = ""
*/
          }

          /* "xpra/x11/bindings/randr.pyx":1254
 *                         if x or y:
 *                             posinfo = " at %i,%i" % (x, y)
 *                         dpiinfo = ""             # <<<<<<<<<<<<<<
 *                         dpix = round(width * 25.4 / mmw)
 *                         dpiy = round(height * 25.4 / mmh)
*/
          __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_);
          __Pyx_XDECREF_SET(__pyx_v_dpiinfo, __pyx_mstate_global->__pyx_kp_u_);

          /* "xpra/x11/bindings/randr.pyx":1255
 *                             posinfo = " at %i,%i" % (x, y)
 *                         dpiinfo = ""
 *                         dpix = round(width * 25.4 / mmw)             # <<<<<<<<<<<<<<
 *                         dpiy = round(height * 25.4 / mmh)
 *                         if abs(dpix-dpiy)<2:
*/
          __pyx_t_12 = NULL;
          __pyx_t_5 = PyNumber_Multiply(__pyx_v_width, __pyx_mstate_global->__pyx_float_25_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1255, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_22 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_mmw); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1255, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_3 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_22};
            __pyx_t_38 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1255, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_38);
          }
          __Pyx_XDECREF_SET(__pyx_v_dpix, __pyx_t_38);
          __pyx_t_38 = 0;

          /* "xpra/x11/bindings/randr.pyx":1256
 *                         dpiinfo = ""
 *                         dpix = round(width * 25.4 / mmw)
 *                         dpiy = round(height * 25.4 / mmh)             # <<<<<<<<<<<<<<
 *                         if abs(dpix-dpiy)<2:
 *                             dpi = round((dpix+dpiy)/2)
*/
          __pyx_t_22 = NULL;
          __pyx_t_12 = PyNumber_Multiply(__pyx_v_height, __pyx_mstate_global->__pyx_float_25_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1256, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_v_mmh); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1256, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_3 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_5};
            __pyx_t_38 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1256, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_38);
          }
          __Pyx_XDECREF_SET(__pyx_v_dpiy, __pyx_t_38);
          __pyx_t_38 = 0;

          /* "xpra/x11/bindings/randr.pyx":1257
 *                         dpix = round(width * 25.4 / mmw)
 *                         dpiy = round(height * 25.4 / mmh)
 *                         if abs(dpix-dpiy)<2:             # <<<<<<<<<<<<<<
 *                             dpi = round((dpix+dpiy)/2)
 *                             dpiinfo = f"dpi={dpi}"
*/
          __pyx_t_38 = PyNumber_Subtract(__pyx_v_dpix, __pyx_v_dpiy); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1257, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_38);
          __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_t_38); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1257, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
          __pyx_t_38 = PyObject_RichCompare(__pyx_t_5, __pyx_mstate_global->__pyx_int_2, Py_LT); __Pyx_XGOTREF(__pyx_t_38); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1257, __pyx_L25_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_38); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1257, __pyx_L25_error)
          __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1258
 *                         dpiy = round(height * 25.4 / mmh)
 *                         if abs(dpix-dpiy)<2:
 *                             dpi = round((dpix+dpiy)/2)             # <<<<<<<<<<<<<<
 *                             dpiinfo = f"dpi={dpi}"
 *                         else:
*/
            __pyx_t_5 = NULL;
            __pyx_t_22 = PyNumber_Add(__pyx_v_dpix, __pyx_v_dpiy); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1258, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_22);
            __pyx_t_12 = __Pyx_PyLong_TrueDivideObjC(__pyx_t_22, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1258, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            __pyx_t_3 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12};
              __pyx_t_38 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1258, __pyx_L25_error)
              __Pyx_GOTREF(__pyx_t_38);
            }
            __Pyx_XDECREF_SET(__pyx_v_dpi, __pyx_t_38);
            __pyx_t_38 = 0;

            /* "xpra/x11/bindings/randr.pyx":1259
 *                         if abs(dpix-dpiy)<2:
 *                             dpi = round((dpix+dpiy)/2)
 *                             dpiinfo = f"dpi={dpi}"             # <<<<<<<<<<<<<<
 *                         else:
 *                             dpiinfo = f"dpi={dpix}x{dpiy}"
*/
            __pyx_t_38 = __Pyx_PyObject_FormatSimple(__pyx_v_dpi, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1259, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_38);
            __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_dpi, __pyx_t_38); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1259, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
            __Pyx_DECREF_SET(__pyx_v_dpiinfo, ((PyObject*)__pyx_t_12));
            __pyx_t_12 = 0;

            /* "xpra/x11/bindings/randr.pyx":1257
 *                         dpix = round(width * 25.4 / mmw)
 *                         dpiy = round(height * 25.4 / mmh)
 *                         if abs(dpix-dpiy)<2:             # <<<<<<<<<<<<<<
 *                             dpi = round((dpix+dpiy)/2)
 *                             dpiinfo = f"dpi={dpi}"
*/
            goto __pyx_L70;
          }

          /* "xpra/x11/bindings/randr.pyx":1261
 *                             dpiinfo = f"dpi={dpi}"
 *                         else:
 *                             dpiinfo = f"dpi={dpix}x{dpiy}"             # <<<<<<<<<<<<<<
 *                         log.info(f"setting dummy crtc and output {i} to:")
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
*/
          /*else*/ {
            __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_dpix, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1261, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_38 = __Pyx_PyObject_FormatSimple(__pyx_v_dpiy, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1261, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_38);
            __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_dpi;
            __pyx_t_16[1] = __pyx_t_12;
            __pyx_t_16[2] = __pyx_mstate_global->__pyx_n_u_x;
            __pyx_t_16[3] = __pyx_t_38;
            __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_38), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_38));
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1261, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
            __Pyx_DECREF_SET(__pyx_v_dpiinfo, ((PyObject*)__pyx_t_5));
            __pyx_t_5 = 0;
          }
          __pyx_L70:;

          /* "xpra/x11/bindings/randr.pyx":1262
 *                         else:
 *                             dpiinfo = f"dpi={dpix}x{dpiy}"
 *                         log.info(f"setting dummy crtc and output {i} to:")             # <<<<<<<<<<<<<<
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
 *                 finally:
*/
          __pyx_t_38 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1262, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1262, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1262, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_setting_dummy_crtc_and_output;
          __pyx_t_6[1] = __pyx_t_12;
          __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_to;
          __pyx_t_37 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 30 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 4, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12));
          if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1262, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_37);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_22))) {
            __pyx_t_38 = PyMethod_GET_SELF(__pyx_t_22);
            assert(__pyx_t_38);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_22);
            __Pyx_INCREF(__pyx_t_38);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_22, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_38, __pyx_t_37};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
            __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1262, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1263
 *                             dpiinfo = f"dpi={dpix}x{dpiy}"
 *                         log.info(f"setting dummy crtc and output {i} to:")
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")             # <<<<<<<<<<<<<<
 *                 finally:
 *                     if output_info:
*/
          __pyx_t_22 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_37);
          __pyx_t_38 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_38);
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
          __pyx_t_37 = __Pyx_PyObject_FormatSimple(__pyx_v_width, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_37);
          __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_height, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_hz, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_v_mmw, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_20 = __Pyx_PyObject_FormatSimple(__pyx_v_mmh, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_40[0] = __pyx_mstate_global->__pyx_kp_u__6;
          __pyx_t_40[1] = __pyx_t_37;
          __pyx_t_40[2] = __pyx_mstate_global->__pyx_n_u_x;
          __pyx_t_40[3] = __pyx_t_12;
          __pyx_t_40[4] = __pyx_mstate_global->__pyx_kp_u__6;
          __pyx_t_40[5] = __pyx_t_4;
          __pyx_t_40[6] = __pyx_mstate_global->__pyx_kp_u_Hz_2;
          __pyx_t_40[7] = __pyx_t_13;
          __pyx_t_40[8] = __pyx_mstate_global->__pyx_n_u_x;
          __pyx_t_40[9] = __pyx_t_20;
          __pyx_t_40[10] = __pyx_mstate_global->__pyx_kp_u_mm;
          __pyx_t_40[11] = __pyx_v_dpiinfo;
          __pyx_t_40[12] = __pyx_mstate_global->__pyx_kp_u__5;
          __pyx_t_40[13] = __pyx_v_posinfo;
          __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_40, 14, 1 * 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_37) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_dpiinfo) + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_posinfo), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_37) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_dpiinfo) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_posinfo));
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1263, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __pyx_t_3 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_38))) {
            __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_38);
            assert(__pyx_t_22);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_38);
            __Pyx_INCREF(__pyx_t_22);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_38, __pyx__function);
            __pyx_t_3 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_7};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_38, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1263, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_L64:;
      }

      /* "xpra/x11/bindings/randr.pyx":1265
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
 *                 finally:
 *                     if output_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
*/
      /*finally:*/ {
        /*normal exit:*/{
          __pyx_t_17 = (__pyx_v_output_info != 0);
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1266
 *                 finally:
 *                     if output_info:
 *                         XRRFreeOutputInfo(output_info)             # <<<<<<<<<<<<<<
 *                         output_info = NULL
 *                     if crtc_info:
*/
            XRRFreeOutputInfo(__pyx_v_output_info);

            /* "xpra/x11/bindings/randr.pyx":1267
 *                     if output_info:
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL             # <<<<<<<<<<<<<<
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)
*/
            __pyx_v_output_info = NULL;

            /* "xpra/x11/bindings/randr.pyx":1265
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
 *                 finally:
 *                     if output_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
*/
          }

          /* "xpra/x11/bindings/randr.pyx":1268
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
 *                     if crtc_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL
*/
          __pyx_t_17 = (__pyx_v_crtc_info != 0);
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1269
 *                         output_info = NULL
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)             # <<<<<<<<<<<<<<
 *                         crtc_info = NULL
 *             self.XSync()
*/
            XRRFreeCrtcInfo(__pyx_v_crtc_info);

            /* "xpra/x11/bindings/randr.pyx":1270
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL             # <<<<<<<<<<<<<<
 *             self.XSync()
 * 
*/
            __pyx_v_crtc_info = NULL;

            /* "xpra/x11/bindings/randr.pyx":1268
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
 *                     if crtc_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL
*/
          }
          goto __pyx_L26;
        }
        __pyx_L25_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_42 = 0; __pyx_t_43 = 0; __pyx_t_44 = 0; __pyx_t_45 = 0; __pyx_t_46 = 0; __pyx_t_47 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
          __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_45, &__pyx_t_46, &__pyx_t_47);
          if ( unlikely(__Pyx_GetException(&__pyx_t_42, &__pyx_t_43, &__pyx_t_44) < 0)) __Pyx_ErrFetch(&__pyx_t_42, &__pyx_t_43, &__pyx_t_44);
          __Pyx_XGOTREF(__pyx_t_42);
          __Pyx_XGOTREF(__pyx_t_43);
          __Pyx_XGOTREF(__pyx_t_44);
          __Pyx_XGOTREF(__pyx_t_45);
          __Pyx_XGOTREF(__pyx_t_46);
          __Pyx_XGOTREF(__pyx_t_47);
          __pyx_t_11 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_41 = __pyx_filename;
          {

            /* "xpra/x11/bindings/randr.pyx":1265
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
 *                 finally:
 *                     if output_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
*/
            __pyx_t_17 = (__pyx_v_output_info != 0);
            if (__pyx_t_17) {

              /* "xpra/x11/bindings/randr.pyx":1266
 *                 finally:
 *                     if output_info:
 *                         XRRFreeOutputInfo(output_info)             # <<<<<<<<<<<<<<
 *                         output_info = NULL
 *                     if crtc_info:
*/
              XRRFreeOutputInfo(__pyx_v_output_info);

              /* "xpra/x11/bindings/randr.pyx":1267
 *                     if output_info:
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL             # <<<<<<<<<<<<<<
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)
*/
              __pyx_v_output_info = NULL;

              /* "xpra/x11/bindings/randr.pyx":1265
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
 *                 finally:
 *                     if output_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
*/
            }

            /* "xpra/x11/bindings/randr.pyx":1268
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
 *                     if crtc_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL
*/
            __pyx_t_17 = (__pyx_v_crtc_info != 0);
            if (__pyx_t_17) {

              /* "xpra/x11/bindings/randr.pyx":1269
 *                         output_info = NULL
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)             # <<<<<<<<<<<<<<
 *                         crtc_info = NULL
 *             self.XSync()
*/
              XRRFreeCrtcInfo(__pyx_v_crtc_info);

              /* "xpra/x11/bindings/randr.pyx":1270
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL             # <<<<<<<<<<<<<<
 *             self.XSync()
 * 
*/
              __pyx_v_crtc_info = NULL;

              /* "xpra/x11/bindings/randr.pyx":1268
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
 *                     if crtc_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL
*/
            }
          }
          __Pyx_XGIVEREF(__pyx_t_45);
          __Pyx_XGIVEREF(__pyx_t_46);
          __Pyx_XGIVEREF(__pyx_t_47);
          __Pyx_ExceptionReset(__pyx_t_45, __pyx_t_46, __pyx_t_47);
          __Pyx_XGIVEREF(__pyx_t_42);
          __Pyx_XGIVEREF(__pyx_t_43);
          __Pyx_XGIVEREF(__pyx_t_44);
          __Pyx_ErrRestore(__pyx_t_42, __pyx_t_43, __pyx_t_44);
          __pyx_t_42 = 0; __pyx_t_43 = 0; __pyx_t_44 = 0; __pyx_t_45 = 0; __pyx_t_46 = 0; __pyx_t_47 = 0;
          __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_41;
          goto __pyx_L17_error;
        }
        __pyx_L22_continue: {

          /* "xpra/x11/bindings/randr.pyx":1265
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
 *                 finally:
 *                     if output_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
*/
          __pyx_t_17 = (__pyx_v_output_info != 0);
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1266
 *                 finally:
 *                     if output_info:
 *                         XRRFreeOutputInfo(output_info)             # <<<<<<<<<<<<<<
 *                         output_info = NULL
 *                     if crtc_info:
*/
            XRRFreeOutputInfo(__pyx_v_output_info);

            /* "xpra/x11/bindings/randr.pyx":1267
 *                     if output_info:
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL             # <<<<<<<<<<<<<<
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)
*/
            __pyx_v_output_info = NULL;

            /* "xpra/x11/bindings/randr.pyx":1265
 *                         log.info(f" {width}x{height} {hz}Hz ({mmw}x{mmh} mm, {dpiinfo}){posinfo}")
 *                 finally:
 *                     if output_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
*/
          }

          /* "xpra/x11/bindings/randr.pyx":1268
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
 *                     if crtc_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL
*/
          __pyx_t_17 = (__pyx_v_crtc_info != 0);
          if (__pyx_t_17) {

            /* "xpra/x11/bindings/randr.pyx":1269
 *                         output_info = NULL
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)             # <<<<<<<<<<<<<<
 *                         crtc_info = NULL
 *             self.XSync()
*/
            XRRFreeCrtcInfo(__pyx_v_crtc_info);

            /* "xpra/x11/bindings/randr.pyx":1270
 *                     if crtc_info:
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL             # <<<<<<<<<<<<<<
 *             self.XSync()
 * 
*/
            __pyx_v_crtc_info = NULL;

            /* "xpra/x11/bindings/randr.pyx":1268
 *                         XRRFreeOutputInfo(output_info)
 *                         output_info = NULL
 *                     if crtc_info:             # <<<<<<<<<<<<<<
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL
*/
          }
          goto __pyx_L19_continue;
        }
        __pyx_L26:;
      }

      /* "xpra/x11/bindings/randr.pyx":1141
 *         new_modes = {}
 *         try:
 *             for i in range(rsc.ncrtc):             # <<<<<<<<<<<<<<
 *                 m = monitor_defs.get(i, {})
 *                 crtc = rsc.crtcs[i]
*/
      __pyx_L19_continue:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1271
 *                         XRRFreeCrtcInfo(crtc_info)
 *                         crtc_info = NULL
 *             self.XSync()             # <<<<<<<<<<<<<<
 * 
 *             # delete all non-automatic monitors:
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_XSync, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1274
 * 
 *             # delete all non-automatic monitors:
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)             # <<<<<<<<<<<<<<
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")
*/
    __pyx_v_monitors = XRRGetMonitors(__pyx_v_self->__pyx_base.display, __pyx_v_window, 1, (&__pyx_v_nmonitors));

    /* "xpra/x11/bindings/randr.pyx":1275
 *             # delete all non-automatic monitors:
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
*/
    __pyx_t_17 = (!(__pyx_v_monitors != 0));
    if (__pyx_t_17) {

      /* "xpra/x11/bindings/randr.pyx":1276
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")             # <<<<<<<<<<<<<<
 *                 return
 *             for mi in range(nmonitors):
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_38, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1276, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_38);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_38, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1276, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_retrieve_the_lis};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1276, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1277
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return             # <<<<<<<<<<<<<<
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L16_return;

      /* "xpra/x11/bindings/randr.pyx":1275
 *             # delete all non-automatic monitors:
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
*/
    }

    /* "xpra/x11/bindings/randr.pyx":1278
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
 *             for mi in range(nmonitors):             # <<<<<<<<<<<<<<
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if not monitors[mi].automatic:
*/
    __pyx_t_7 = NULL;
    __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_nmonitors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1278, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1278, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1278, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1278, __pyx_L17_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      {
        __pyx_t_1 = __pyx_t_19(__pyx_t_5);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1278, __pyx_L17_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_mi, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1279
 *                 return
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)             # <<<<<<<<<<<<<<
 *                 if not monitors[mi].automatic:
 *                     log("deleting %i: %r", mi, name)
*/
      __pyx_t_7 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_mi); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1279, __pyx_L17_error)
      __pyx_t_38 = __Pyx_PyLong_From_unsigned_long((__pyx_v_monitors[__pyx_t_9]).name); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1279, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_38);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_38};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_atom_name, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1280
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if not monitors[mi].automatic:             # <<<<<<<<<<<<<<
 *                     log("deleting %i: %r", mi, name)
 *                     XRRDeleteMonitor(self.display, window, monitors[mi].name)
*/
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_mi); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1280, __pyx_L17_error)
      __pyx_t_17 = (!((__pyx_v_monitors[__pyx_t_9]).automatic != 0));
      if (__pyx_t_17) {

        /* "xpra/x11/bindings/randr.pyx":1281
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if not monitors[mi].automatic:
 *                     log("deleting %i: %r", mi, name)             # <<<<<<<<<<<<<<
 *                     XRRDeleteMonitor(self.display, window, monitors[mi].name)
 *                 else:
*/
        __pyx_t_38 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1281, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_38 = PyMethod_GET_SELF(__pyx_t_7);
          assert(__pyx_t_38);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_38);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_38, __pyx_mstate_global->__pyx_kp_u_deleting_i_r, __pyx_v_mi, __pyx_v_name};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1281, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":1282
 *                 if not monitors[mi].automatic:
 *                     log("deleting %i: %r", mi, name)
 *                     XRRDeleteMonitor(self.display, window, monitors[mi].name)             # <<<<<<<<<<<<<<
 *                 else:
 *                     log("keeping %i: %r", mi, name)
*/
        __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_mi); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1282, __pyx_L17_error)
        XRRDeleteMonitor(__pyx_v_self->__pyx_base.display, __pyx_v_window, (__pyx_v_monitors[__pyx_t_9]).name);

        /* "xpra/x11/bindings/randr.pyx":1280
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if not monitors[mi].automatic:             # <<<<<<<<<<<<<<
 *                     log("deleting %i: %r", mi, name)
 *                     XRRDeleteMonitor(self.display, window, monitors[mi].name)
*/
        goto __pyx_L85;
      }

      /* "xpra/x11/bindings/randr.pyx":1284
 *                     XRRDeleteMonitor(self.display, window, monitors[mi].name)
 *                 else:
 *                     log("keeping %i: %r", mi, name)             # <<<<<<<<<<<<<<
 *             XRRFreeMonitors(monitors)
 * 
*/
      /*else*/ {
        __pyx_t_7 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_38, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1284, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_38);
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_38))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_38);
          assert(__pyx_t_7);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_38);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_38, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_keeping_i_r, __pyx_v_mi, __pyx_v_name};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_38, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1284, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L85:;

      /* "xpra/x11/bindings/randr.pyx":1278
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
 *             for mi in range(nmonitors):             # <<<<<<<<<<<<<<
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if not monitors[mi].automatic:
*/
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1285
 *                 else:
 *                     log("keeping %i: %r", mi, name)
 *             XRRFreeMonitors(monitors)             # <<<<<<<<<<<<<<
 * 
 *             # retrieve again:
*/
    XRRFreeMonitors(__pyx_v_monitors);

    /* "xpra/x11/bindings/randr.pyx":1288
 * 
 *             # retrieve again:
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)             # <<<<<<<<<<<<<<
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")
*/
    __pyx_v_monitors = XRRGetMonitors(__pyx_v_self->__pyx_base.display, __pyx_v_window, 1, (&__pyx_v_nmonitors));

    /* "xpra/x11/bindings/randr.pyx":1289
 *             # retrieve again:
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
*/
    __pyx_t_17 = (!(__pyx_v_monitors != 0));
    if (__pyx_t_17) {

      /* "xpra/x11/bindings/randr.pyx":1290
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")             # <<<<<<<<<<<<<<
 *                 return
 *             monitor_names = []
*/
      __pyx_t_1 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_38, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1290, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_38);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_38, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1290, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_retrieve_the_lis};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1290, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "xpra/x11/bindings/randr.pyx":1291
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return             # <<<<<<<<<<<<<<
 *             monitor_names = []
 *             for mi in range(nmonitors):
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L16_return;

      /* "xpra/x11/bindings/randr.pyx":1289
 *             # retrieve again:
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
*/
    }

    /* "xpra/x11/bindings/randr.pyx":1292
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
 *             monitor_names = []             # <<<<<<<<<<<<<<
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)
*/
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1292, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_monitor_names = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1293
 *                 return
 *             monitor_names = []
 *             for mi in range(nmonitors):             # <<<<<<<<<<<<<<
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if name not in monitor_names:
*/
    __pyx_t_7 = NULL;
    __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_nmonitors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1293, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1293, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1293, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1293, __pyx_L17_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      {
        __pyx_t_5 = __pyx_t_19(__pyx_t_1);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1293, __pyx_L17_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_mi, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "xpra/x11/bindings/randr.pyx":1294
 *             monitor_names = []
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)             # <<<<<<<<<<<<<<
 *                 if name not in monitor_names:
 *                     monitor_names.append(name)
*/
      __pyx_t_7 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_mi); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1294, __pyx_L17_error)
      __pyx_t_38 = __Pyx_PyLong_From_unsigned_long((__pyx_v_monitors[__pyx_t_9]).name); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1294, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_38);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_38};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_atom_name, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1294, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "xpra/x11/bindings/randr.pyx":1295
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if name not in monitor_names:             # <<<<<<<<<<<<<<
 *                     monitor_names.append(name)
 *             log("monitors: %s", monitor_names)
*/
      __pyx_t_17 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_monitor_names, Py_NE)); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1295, __pyx_L17_error)
      if (__pyx_t_17) {

        /* "xpra/x11/bindings/randr.pyx":1296
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if name not in monitor_names:
 *                     monitor_names.append(name)             # <<<<<<<<<<<<<<
 *             log("monitors: %s", monitor_names)
 * 
*/
        __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_monitor_names, __pyx_v_name); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1296, __pyx_L17_error)

        /* "xpra/x11/bindings/randr.pyx":1295
 *             for mi in range(nmonitors):
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if name not in monitor_names:             # <<<<<<<<<<<<<<
 *                     monitor_names.append(name)
 *             log("monitors: %s", monitor_names)
*/
      }

      /* "xpra/x11/bindings/randr.pyx":1293
 *                 return
 *             monitor_names = []
 *             for mi in range(nmonitors):             # <<<<<<<<<<<<<<
 *                 name = self.get_atom_name(monitors[mi].name)
 *                 if name not in monitor_names:
*/
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1297
 *                 if name not in monitor_names:
 *                     monitor_names.append(name)
 *             log("monitors: %s", monitor_names)             # <<<<<<<<<<<<<<
 * 
 *             all_names = output_names + monitor_names
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_38, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1297, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_38);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_38))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_38);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_38);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_38, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_monitors_s, __pyx_v_monitor_names};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_38, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1297, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1299
 *             log("monitors: %s", monitor_names)
 * 
 *             all_names = output_names + monitor_names             # <<<<<<<<<<<<<<
 *             log("reserved names: %s", csv(all_names))
 *             active_names = []
*/
    __pyx_t_1 = PyNumber_Add(__pyx_v_output_names, __pyx_v_monitor_names); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1299, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_all_names = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1300
 * 
 *             all_names = output_names + monitor_names
 *             log("reserved names: %s", csv(all_names))             # <<<<<<<<<<<<<<
 *             active_names = []
 *             try:
*/
    __pyx_t_38 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1300, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_22 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_csv); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1300, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_20);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_20))) {
      __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
      assert(__pyx_t_22);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_20);
      __Pyx_INCREF(__pyx_t_22);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_20, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_v_all_names};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_20, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1300, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_38 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_38);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_38);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_38, __pyx_mstate_global->__pyx_kp_u_reserved_names_s, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1301
 *             all_names = output_names + monitor_names
 *             log("reserved names: %s", csv(all_names))
 *             active_names = []             # <<<<<<<<<<<<<<
 *             try:
 *                 mi = 0
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_active_names = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1302
 *             log("reserved names: %s", csv(all_names))
 *             active_names = []
 *             try:             # <<<<<<<<<<<<<<
 *                 mi = 0
 *                 ext_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
*/
    /*try:*/ {

      /* "xpra/x11/bindings/randr.pyx":1303
 *             active_names = []
 *             try:
 *                 mi = 0             # <<<<<<<<<<<<<<
 *                 ext_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 *                 seq = 0
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
      __Pyx_XDECREF_SET(__pyx_v_mi, __pyx_mstate_global->__pyx_int_0);

      /* "xpra/x11/bindings/randr.pyx":1304
 *             try:
 *                 mi = 0
 *                 ext_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"             # <<<<<<<<<<<<<<
 *                 seq = 0
 *                 for i, m  in monitor_defs.items():
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ABCDEFGHIJKLMNOPQRSTUVWXYZ);
      __pyx_v_ext_chars = __pyx_mstate_global->__pyx_n_u_ABCDEFGHIJKLMNOPQRSTUVWXYZ;

      /* "xpra/x11/bindings/randr.pyx":1305
 *                 mi = 0
 *                 ext_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 *                 seq = 0             # <<<<<<<<<<<<<<
 *                 for i, m  in monitor_defs.items():
 *                     basename = "VFB" if mi == 0 else f"VFB{mi}"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
      __pyx_v_seq = __pyx_mstate_global->__pyx_int_0;

      /* "xpra/x11/bindings/randr.pyx":1306
 *                 ext_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 *                 seq = 0
 *                 for i, m  in monitor_defs.items():             # <<<<<<<<<<<<<<
 *                     basename = "VFB" if mi == 0 else f"VFB{mi}"
 *                     name = prettify_plug_name(m.get("name", ""))
*/
      __pyx_t_9 = 0;
      __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_monitor_defs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_8), (&__pyx_t_10)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1306, __pyx_L93_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_1);
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
      while (1) {
        __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_8, &__pyx_t_9, &__pyx_t_5, &__pyx_t_7, NULL, __pyx_t_10);
        if (unlikely(__pyx_t_11 == 0)) break;
        if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 1306, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "xpra/x11/bindings/randr.pyx":1307
 *                 seq = 0
 *                 for i, m  in monitor_defs.items():
 *                     basename = "VFB" if mi == 0 else f"VFB{mi}"             # <<<<<<<<<<<<<<
 *                     name = prettify_plug_name(m.get("name", ""))
 *                     if not name or name in all_names:
*/
        __pyx_t_17 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_mi, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1307, __pyx_L93_error)
        if (__pyx_t_17) {
          __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_VFB);
          __pyx_t_7 = __pyx_mstate_global->__pyx_n_u_VFB;
        } else {
          __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_mi, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1307, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_38 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_n_u_VFB, __pyx_t_5); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1307, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_38);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_7 = __pyx_t_38;
          __pyx_t_38 = 0;
        }
        __Pyx_XDECREF_SET(__pyx_v_basename, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "xpra/x11/bindings/randr.pyx":1308
 *                 for i, m  in monitor_defs.items():
 *                     basename = "VFB" if mi == 0 else f"VFB{mi}"
 *                     name = prettify_plug_name(m.get("name", ""))             # <<<<<<<<<<<<<<
 *                     if not name or name in all_names:
 *                         name = basename
*/
        __pyx_t_38 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_prettify_plug_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1308, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1308, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_mstate_global->__pyx_tuple[9], NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1308, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_38 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_38);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_38);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_38, __pyx_t_22};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1308, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "xpra/x11/bindings/randr.pyx":1309
 *                     basename = "VFB" if mi == 0 else f"VFB{mi}"
 *                     name = prettify_plug_name(m.get("name", ""))
 *                     if not name or name in all_names:             # <<<<<<<<<<<<<<
 *                         name = basename
 *                     while name in all_names and seq < len(ext_chars):
*/
        __pyx_t_25 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely((__pyx_t_25 < 0))) __PYX_ERR(0, 1309, __pyx_L93_error)
        __pyx_t_15 = (!__pyx_t_25);
        if (!__pyx_t_15) {
        } else {
          __pyx_t_17 = __pyx_t_15;
          goto __pyx_L98_bool_binop_done;
        }
        __pyx_t_15 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_all_names, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1309, __pyx_L93_error)
        __pyx_t_17 = __pyx_t_15;
        __pyx_L98_bool_binop_done:;
        if (__pyx_t_17) {

          /* "xpra/x11/bindings/randr.pyx":1310
 *                     name = prettify_plug_name(m.get("name", ""))
 *                     if not name or name in all_names:
 *                         name = basename             # <<<<<<<<<<<<<<
 *                     while name in all_names and seq < len(ext_chars):
 *                         ext = ext_chars[seq:seq+1]
*/
          __Pyx_INCREF(__pyx_v_basename);
          __Pyx_DECREF_SET(__pyx_v_name, __pyx_v_basename);

          /* "xpra/x11/bindings/randr.pyx":1309
 *                     basename = "VFB" if mi == 0 else f"VFB{mi}"
 *                     name = prettify_plug_name(m.get("name", ""))
 *                     if not name or name in all_names:             # <<<<<<<<<<<<<<
 *                         name = basename
 *                     while name in all_names and seq < len(ext_chars):
*/
        }

        /* "xpra/x11/bindings/randr.pyx":1311
 *                     if not name or name in all_names:
 *                         name = basename
 *                     while name in all_names and seq < len(ext_chars):             # <<<<<<<<<<<<<<
 *                         ext = ext_chars[seq:seq+1]
 *                         seq += 1
*/
        while (1) {
          __pyx_t_15 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_all_names, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1311, __pyx_L93_error)
          if (__pyx_t_15) {
          } else {
            __pyx_t_17 = __pyx_t_15;
            goto __pyx_L102_bool_binop_done;
          }
          __pyx_t_48 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_ext_chars); if (unlikely(__pyx_t_48 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1311, __pyx_L93_error)
          __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_48); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1311, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_5 = PyObject_RichCompare(__pyx_v_seq, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1311, __pyx_L93_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1311, __pyx_L93_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_17 = __pyx_t_15;
          __pyx_L102_bool_binop_done:;
          if (!__pyx_t_17) break;

          /* "xpra/x11/bindings/randr.pyx":1312
 *                         name = basename
 *                     while name in all_names and seq < len(ext_chars):
 *                         ext = ext_chars[seq:seq+1]             # <<<<<<<<<<<<<<
 *                         seq += 1
 *                         name = f"{basename}{ext}"
*/
          __Pyx_INCREF(__pyx_v_seq);
          __pyx_t_5 = __pyx_v_seq;
          __pyx_t_17 = (__pyx_t_5 == Py_None);
          if (__pyx_t_17) {
            __pyx_t_48 = 0;
          } else {
            __pyx_t_49 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_49 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1312, __pyx_L93_error)
            __pyx_t_48 = __pyx_t_49;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_v_seq, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1312, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_17 = (__pyx_t_5 == Py_None);
          if (__pyx_t_17) {
            __pyx_t_49 = PY_SSIZE_T_MAX;
          } else {
            __pyx_t_50 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_50 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1312, __pyx_L93_error)
            __pyx_t_49 = __pyx_t_50;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyUnicode_Substring(__pyx_v_ext_chars, __pyx_t_48, __pyx_t_49); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1312, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_v_ext, ((PyObject*)__pyx_t_5));
          __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1313
 *                     while name in all_names and seq < len(ext_chars):
 *                         ext = ext_chars[seq:seq+1]
 *                         seq += 1             # <<<<<<<<<<<<<<
 *                         name = f"{basename}{ext}"
 *                     all_names.append(name)
*/
          __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_v_seq, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1313, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF_SET(__pyx_v_seq, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "xpra/x11/bindings/randr.pyx":1314
 *                         ext = ext_chars[seq:seq+1]
 *                         seq += 1
 *                         name = f"{basename}{ext}"             # <<<<<<<<<<<<<<
 *                     all_names.append(name)
 *                     active_names.append(name)
*/
          __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_basename); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1314, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_7 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_t_5, __pyx_v_ext); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1314, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_7);
          __pyx_t_7 = 0;
        }

        /* "xpra/x11/bindings/randr.pyx":1315
 *                         seq += 1
 *                         name = f"{basename}{ext}"
 *                     all_names.append(name)             # <<<<<<<<<<<<<<
 *                     active_names.append(name)
 *                     log(f"matching monitor index {mi} to {i}: {m}, using name={name!r}")
*/
        __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_all_names, __pyx_v_name); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1315, __pyx_L93_error)

        /* "xpra/x11/bindings/randr.pyx":1316
 *                         name = f"{basename}{ext}"
 *                     all_names.append(name)
 *                     active_names.append(name)             # <<<<<<<<<<<<<<
 *                     log(f"matching monitor index {mi} to {i}: {m}, using name={name!r}")
 *                     x, y, width, height = m["geometry"]
*/
        __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_active_names, __pyx_v_name); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1316, __pyx_L93_error)

        /* "xpra/x11/bindings/randr.pyx":1317
 *                     all_names.append(name)
 *                     active_names.append(name)
 *                     log(f"matching monitor index {mi} to {i}: {m}, using name={name!r}")             # <<<<<<<<<<<<<<
 *                     x, y, width, height = m["geometry"]
 *                     memset(&monitor, 0, sizeof(XRRMonitorInfo))
*/
        __pyx_t_5 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1317, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_38 = __Pyx_PyObject_FormatSimple(__pyx_v_mi, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1317, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_38);
        __pyx_t_20 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1317, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_v_m, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1317, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1317, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_35[0] = __pyx_mstate_global->__pyx_kp_u_matching_monitor_index;
        __pyx_t_35[1] = __pyx_t_38;
        __pyx_t_35[2] = __pyx_mstate_global->__pyx_kp_u_to_2;
        __pyx_t_35[3] = __pyx_t_20;
        __pyx_t_35[4] = __pyx_mstate_global->__pyx_kp_u__10;
        __pyx_t_35[5] = __pyx_t_13;
        __pyx_t_35[6] = __pyx_mstate_global->__pyx_kp_u_using_name;
        __pyx_t_35[7] = __pyx_t_4;
        __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_35, 8, 23 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_38) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_38) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1317, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_22))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_22);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_22);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_22, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1317, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "xpra/x11/bindings/randr.pyx":1318
 *                     active_names.append(name)
 *                     log(f"matching monitor index {mi} to {i}: {m}, using name={name!r}")
 *                     x, y, width, height = m["geometry"]             # <<<<<<<<<<<<<<
 *                     memset(&monitor, 0, sizeof(XRRMonitorInfo))
 *                     monitor.name = self.str_to_atom(name)
*/
        __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_m, __pyx_mstate_global->__pyx_n_u_geometry); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1318, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_7);
        if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
          PyObject* sequence = __pyx_t_7;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 4)) {
            if (size > 4) __Pyx_RaiseTooManyValuesError(4);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1318, __pyx_L93_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_22 = PyTuple_GET_ITEM(sequence, 0);
            __Pyx_INCREF(__pyx_t_22);
            __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
            __Pyx_INCREF(__pyx_t_12);
            __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
            __Pyx_INCREF(__pyx_t_5);
            __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3);
            __Pyx_INCREF(__pyx_t_4);
          } else {
            __pyx_t_22 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1318, __pyx_L93_error)
            __Pyx_XGOTREF(__pyx_t_22);
            __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1318, __pyx_L93_error)
            __Pyx_XGOTREF(__pyx_t_12);
            __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1318, __pyx_L93_error)
            __Pyx_XGOTREF(__pyx_t_5);
            __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1318, __pyx_L93_error)
            __Pyx_XGOTREF(__pyx_t_4);
          }
          #else
          {
            Py_ssize_t i;
            PyObject** temps[4] = {&__pyx_t_22,&__pyx_t_12,&__pyx_t_5,&__pyx_t_4};
            for (i=0; i < 4; i++) {
              PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1318, __pyx_L93_error)
              __Pyx_GOTREF(item);
              *(temps[i]) = item;
            }
          }
          #endif
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          Py_ssize_t index = -1;
          PyObject** temps[4] = {&__pyx_t_22,&__pyx_t_12,&__pyx_t_5,&__pyx_t_4};
          __pyx_t_13 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1318, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
          for (index=0; index < 4; index++) {
            PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L104_unpacking_failed;
            __Pyx_GOTREF(item);
            *(temps[index]) = item;
          }
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < (0)) __PYX_ERR(0, 1318, __pyx_L93_error)
          __pyx_t_14 = NULL;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L105_unpacking_done;
          __pyx_L104_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_14 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 1318, __pyx_L93_error)
          __pyx_L105_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_22);
        __pyx_t_22 = 0;
        __Pyx_XDECREF_SET(__pyx_v_y, __pyx_t_12);
        __pyx_t_12 = 0;
        __Pyx_XDECREF_SET(__pyx_v_width, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_height, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "xpra/x11/bindings/randr.pyx":1319
 *                     log(f"matching monitor index {mi} to {i}: {m}, using name={name!r}")
 *                     x, y, width, height = m["geometry"]
 *                     memset(&monitor, 0, sizeof(XRRMonitorInfo))             # <<<<<<<<<<<<<<
 *                     monitor.name = self.str_to_atom(name)
 *                     monitor.primary = m.get("primary", primary==mi)
*/
        (void)(memset((&__pyx_v_monitor), 0, (sizeof(XRRMonitorInfo))));

        /* "xpra/x11/bindings/randr.pyx":1320
 *                     x, y, width, height = m["geometry"]
 *                     memset(&monitor, 0, sizeof(XRRMonitorInfo))
 *                     monitor.name = self.str_to_atom(name)             # <<<<<<<<<<<<<<
 *                     monitor.primary = m.get("primary", primary==mi)
 *                     monitor.automatic = False    # ignore client property: m.get("automatic", True)
*/
        __pyx_t_51 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.str_to_atom(((struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *)__pyx_v_self), __pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1320, __pyx_L93_error)
        __pyx_v_monitor.name = __pyx_t_51;

        /* "xpra/x11/bindings/randr.pyx":1321
 *                     memset(&monitor, 0, sizeof(XRRMonitorInfo))
 *                     monitor.name = self.str_to_atom(name)
 *                     monitor.primary = m.get("primary", primary==mi)             # <<<<<<<<<<<<<<
 *                     monitor.automatic = False    # ignore client property: m.get("automatic", True)
 *                     monitor.x = x
*/
        __pyx_t_4 = __pyx_v_m;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyLong_From_long(__pyx_v_primary); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1321, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_v_mi, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1321, __pyx_L93_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_primary, __pyx_t_12};
          __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1321, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_52 = __Pyx_PyLong_As_int(__pyx_t_7); if (unlikely((__pyx_t_52 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1321, __pyx_L93_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_monitor.primary = __pyx_t_52;

        /* "xpra/x11/bindings/randr.pyx":1322
 *                     monitor.name = self.str_to_atom(name)
 *                     monitor.primary = m.get("primary", primary==mi)
 *                     monitor.automatic = False    # ignore client property: m.get("automatic", True)             # <<<<<<<<<<<<<<
 *                     monitor.x = x
 *                     monitor.y = y
*/
        __pyx_v_monitor.automatic = 0;

        /* "xpra/x11/bindings/randr.pyx":1323
 *                     monitor.primary = m.get("primary", primary==mi)
 *                     monitor.automatic = False    # ignore client property: m.get("automatic", True)
 *                     monitor.x = x             # <<<<<<<<<<<<<<
 *                     monitor.y = y
 *                     monitor.width = width
*/
        __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_x); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1323, __pyx_L93_error)
        __pyx_v_monitor.x = __pyx_t_11;

        /* "xpra/x11/bindings/randr.pyx":1324
 *                     monitor.automatic = False    # ignore client property: m.get("automatic", True)
 *                     monitor.x = x
 *                     monitor.y = y             # <<<<<<<<<<<<<<
 *                     monitor.width = width
 *                     monitor.height = height
*/
        __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_y); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1324, __pyx_L93_error)
        __pyx_v_monitor.y = __pyx_t_11;

        /* "xpra/x11/bindings/randr.pyx":1325
 *                     monitor.x = x
 *                     monitor.y = y
 *                     monitor.width = width             # <<<<<<<<<<<<<<
 *                     monitor.height = height
 *                     monitor.mwidth = m.get("width-mm", dpi96(monitor.width))
*/
        __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_width); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1325, __pyx_L93_error)
        __pyx_v_monitor.width = __pyx_t_11;

        /* "xpra/x11/bindings/randr.pyx":1326
 *                     monitor.y = y
 *                     monitor.width = width
 *                     monitor.height = height             # <<<<<<<<<<<<<<
 *                     monitor.mwidth = m.get("width-mm", dpi96(monitor.width))
 *                     monitor.mheight = m.get("height-mm", dpi96(monitor.height))
*/
        __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_height); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1326, __pyx_L93_error)
        __pyx_v_monitor.height = __pyx_t_11;

        /* "xpra/x11/bindings/randr.pyx":1327
 *                     monitor.width = width
 *                     monitor.height = height
 *                     monitor.mwidth = m.get("width-mm", dpi96(monitor.width))             # <<<<<<<<<<<<<<
 *                     monitor.mheight = m.get("height-mm", dpi96(monitor.height))
 *                     assert rsc.noutput>i, f"only {rsc.noutput} outputs, cannot set {i}"
*/
        __pyx_t_12 = __pyx_v_m;
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_monitor.width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1327, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(__pyx_v_dpi96, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1327, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_width_mm, __pyx_t_5};
          __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1327, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1327, __pyx_L93_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_monitor.mwidth = __pyx_t_11;

        /* "xpra/x11/bindings/randr.pyx":1328
 *                     monitor.height = height
 *                     monitor.mwidth = m.get("width-mm", dpi96(monitor.width))
 *                     monitor.mheight = m.get("height-mm", dpi96(monitor.height))             # <<<<<<<<<<<<<<
 *                     assert rsc.noutput>i, f"only {rsc.noutput} outputs, cannot set {i}"
 *                     output = rsc.outputs[i]
*/
        __pyx_t_5 = __pyx_v_m;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_12 = __Pyx_PyLong_From_int(__pyx_v_monitor.height); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1328, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_4 = __pyx_pf_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15set_crtc_config_dpi96(__pyx_v_dpi96, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1328, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_height_mm, __pyx_t_4};
          __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1328, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1328, __pyx_L93_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_monitor.mheight = __pyx_t_11;

        /* "xpra/x11/bindings/randr.pyx":1329
 *                     monitor.mwidth = m.get("width-mm", dpi96(monitor.width))
 *                     monitor.mheight = m.get("height-mm", dpi96(monitor.height))
 *                     assert rsc.noutput>i, f"only {rsc.noutput} outputs, cannot set {i}"             # <<<<<<<<<<<<<<
 *                     output = rsc.outputs[i]
 *                     monitor.outputs = &output
*/
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_rsc->noutput); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1329, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L93_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1329, __pyx_L93_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_17)) {
            __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_rsc->noutput, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L93_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1329, __pyx_L93_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_only_2;
            __pyx_t_16[1] = __pyx_t_4;
            __pyx_t_16[2] = __pyx_mstate_global->__pyx_kp_u_outputs_cannot_set;
            __pyx_t_16[3] = __pyx_t_7;
            __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1329, __pyx_L93_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_5, 0, 0);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __PYX_ERR(0, 1329, __pyx_L93_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(0, 1329, __pyx_L93_error)
        #endif

        /* "xpra/x11/bindings/randr.pyx":1330
 *                     monitor.mheight = m.get("height-mm", dpi96(monitor.height))
 *                     assert rsc.noutput>i, f"only {rsc.noutput} outputs, cannot set {i}"
 *                     output = rsc.outputs[i]             # <<<<<<<<<<<<<<
 *                     monitor.outputs = &output
 *                     monitor.noutput = 1
*/
        __pyx_t_49 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_49 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1330, __pyx_L93_error)
        __pyx_v_output = (__pyx_v_rsc->outputs[__pyx_t_49]);

        /* "xpra/x11/bindings/randr.pyx":1331
 *                     assert rsc.noutput>i, f"only {rsc.noutput} outputs, cannot set {i}"
 *                     output = rsc.outputs[i]
 *                     monitor.outputs = &output             # <<<<<<<<<<<<<<
 *                     monitor.noutput = 1
 *                     log("XRRSetMonitor(%#x, %#x, %#x) output=%i, geometry=%s (%ix%i mm)",
*/
        __pyx_v_monitor.outputs = (&__pyx_v_output);

        /* "xpra/x11/bindings/randr.pyx":1332
 *                     output = rsc.outputs[i]
 *                     monitor.outputs = &output
 *                     monitor.noutput = 1             # <<<<<<<<<<<<<<
 *                     log("XRRSetMonitor(%#x, %#x, %#x) output=%i, geometry=%s (%ix%i mm)",
 *                         <uintptr_t> self.display, <uintptr_t> window, <uintptr_t> &monitor, output,
*/
        __pyx_v_monitor.noutput = 1;

        /* "xpra/x11/bindings/randr.pyx":1333
 *                     monitor.outputs = &output
 *                     monitor.noutput = 1
 *                     log("XRRSetMonitor(%#x, %#x, %#x) output=%i, geometry=%s (%ix%i mm)",             # <<<<<<<<<<<<<<
 *                         <uintptr_t> self.display, <uintptr_t> window, <uintptr_t> &monitor, output,
 *                         (monitor.x, monitor.y, monitor.width, monitor.height),
*/
        __pyx_t_7 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1333, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_4);

        /* "xpra/x11/bindings/randr.pyx":1334
 *                     monitor.noutput = 1
 *                     log("XRRSetMonitor(%#x, %#x, %#x) output=%i, geometry=%s (%ix%i mm)",
 *                         <uintptr_t> self.display, <uintptr_t> window, <uintptr_t> &monitor, output,             # <<<<<<<<<<<<<<
 *                         (monitor.x, monitor.y, monitor.width, monitor.height),
 *                         monitor.mwidth, monitor.mheight)
*/
        __pyx_t_12 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_self->__pyx_base.display)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1334, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_22 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_window)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1334, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_13 = __Pyx_PyLong_FromSize_t(((uintptr_t)(&__pyx_v_monitor))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1334, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_20 = __Pyx_PyLong_From_unsigned_long(__pyx_v_output); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1334, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_20);

        /* "xpra/x11/bindings/randr.pyx":1335
 *                     log("XRRSetMonitor(%#x, %#x, %#x) output=%i, geometry=%s (%ix%i mm)",
 *                         <uintptr_t> self.display, <uintptr_t> window, <uintptr_t> &monitor, output,
 *                         (monitor.x, monitor.y, monitor.width, monitor.height),             # <<<<<<<<<<<<<<
 *                         monitor.mwidth, monitor.mheight)
 *                     log.info(f"monitor {mi} is {name!r} {monitor.width}x{monitor.height}")
*/
        __pyx_t_38 = __Pyx_PyLong_From_int(__pyx_v_monitor.x); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1335, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_38);
        __pyx_t_37 = __Pyx_PyLong_From_int(__pyx_v_monitor.y); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1335, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_37);
        __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_monitor.width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1335, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_53 = __Pyx_PyLong_From_int(__pyx_v_monitor.height); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1335, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_53);
        __pyx_t_54 = PyTuple_New(4); if (unlikely(!__pyx_t_54)) __PYX_ERR(0, 1335, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_54);
        __Pyx_GIVEREF(__pyx_t_38);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_54, 0, __pyx_t_38) != (0)) __PYX_ERR(0, 1335, __pyx_L93_error);
        __Pyx_GIVEREF(__pyx_t_37);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_54, 1, __pyx_t_37) != (0)) __PYX_ERR(0, 1335, __pyx_L93_error);
        __Pyx_GIVEREF(__pyx_t_2);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_54, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 1335, __pyx_L93_error);
        __Pyx_GIVEREF(__pyx_t_53);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_54, 3, __pyx_t_53) != (0)) __PYX_ERR(0, 1335, __pyx_L93_error);
        __pyx_t_38 = 0;
        __pyx_t_37 = 0;
        __pyx_t_2 = 0;
        __pyx_t_53 = 0;

        /* "xpra/x11/bindings/randr.pyx":1336
 *                         <uintptr_t> self.display, <uintptr_t> window, <uintptr_t> &monitor, output,
 *                         (monitor.x, monitor.y, monitor.width, monitor.height),
 *                         monitor.mwidth, monitor.mheight)             # <<<<<<<<<<<<<<
 *                     log.info(f"monitor {mi} is {name!r} {monitor.width}x{monitor.height}")
 *                     XRRSetMonitor(self.display, window, &monitor)
*/
        __pyx_t_53 = __Pyx_PyLong_From_int(__pyx_v_monitor.mwidth); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1336, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_53);
        __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_monitor.mheight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_7);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[9] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_XRRSetMonitor_x_x_x_output_i_geo, __pyx_t_12, __pyx_t_22, __pyx_t_13, __pyx_t_20, __pyx_t_54, __pyx_t_53, __pyx_t_2};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (9-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_DECREF(__pyx_t_54); __pyx_t_54 = 0;
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1333, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "xpra/x11/bindings/randr.pyx":1337
 *                         (monitor.x, monitor.y, monitor.width, monitor.height),
 *                         monitor.mwidth, monitor.mheight)
 *                     log.info(f"monitor {mi} is {name!r} {monitor.width}x{monitor.height}")             # <<<<<<<<<<<<<<
 *                     XRRSetMonitor(self.display, window, &monitor)
 *                     mi += 1
*/
        __pyx_t_4 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_53 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1337, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_53);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_mi, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_54 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_54)) __PYX_ERR(0, 1337, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_54);
        __pyx_t_20 = __Pyx_PyUnicode_From_int(__pyx_v_monitor.width, 0, ' ', 'd'); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1337, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_13 = __Pyx_PyUnicode_From_int(__pyx_v_monitor.height, 0, ' ', 'd'); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1337, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_35[0] = __pyx_mstate_global->__pyx_kp_u_monitor;
        __pyx_t_35[1] = __pyx_t_2;
        __pyx_t_35[2] = __pyx_mstate_global->__pyx_kp_u_is;
        __pyx_t_35[3] = __pyx_t_54;
        __pyx_t_35[4] = __pyx_mstate_global->__pyx_kp_u__6;
        __pyx_t_35[5] = __pyx_t_20;
        __pyx_t_35[6] = __pyx_mstate_global->__pyx_n_u_x;
        __pyx_t_35[7] = __pyx_t_13;
        __pyx_t_22 = __Pyx_PyUnicode_Join(__pyx_t_35, 8, 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_54) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_54));
        if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1337, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_54); __pyx_t_54 = 0;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_3 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_53))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_53);
          assert(__pyx_t_4);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_53);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_53, __pyx__function);
          __pyx_t_3 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_22};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_53, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1337, __pyx_L93_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "xpra/x11/bindings/randr.pyx":1338
 *                         monitor.mwidth, monitor.mheight)
 *                     log.info(f"monitor {mi} is {name!r} {monitor.width}x{monitor.height}")
 *                     XRRSetMonitor(self.display, window, &monitor)             # <<<<<<<<<<<<<<
 *                     mi += 1
 *             finally:
*/
        XRRSetMonitor(__pyx_v_self->__pyx_base.display, __pyx_v_window, (&__pyx_v_monitor));

        /* "xpra/x11/bindings/randr.pyx":1339
 *                     log.info(f"monitor {mi} is {name!r} {monitor.width}x{monitor.height}")
 *                     XRRSetMonitor(self.display, window, &monitor)
 *                     mi += 1             # <<<<<<<<<<<<<<
 *             finally:
 *                 XRRFreeMonitors(monitors)
*/
        __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_v_mi, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1339, __pyx_L93_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_mi, __pyx_t_5);
        __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "xpra/x11/bindings/randr.pyx":1341
 *                     mi += 1
 *             finally:
 *                 XRRFreeMonitors(monitors)             # <<<<<<<<<<<<<<
 * 
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
*/
    /*finally:*/ {
      /*normal exit:*/{
        XRRFreeMonitors(__pyx_v_monitors);
        goto __pyx_L94;
      }
      __pyx_L93_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_47 = 0; __pyx_t_46 = 0; __pyx_t_45 = 0; __pyx_t_44 = 0; __pyx_t_43 = 0; __pyx_t_42 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
        __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_53); __pyx_t_53 = 0;
        __Pyx_XDECREF(__pyx_t_54); __pyx_t_54 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_ExceptionSwap(&__pyx_t_44, &__pyx_t_43, &__pyx_t_42);
        if ( unlikely(__Pyx_GetException(&__pyx_t_47, &__pyx_t_46, &__pyx_t_45) < 0)) __Pyx_ErrFetch(&__pyx_t_47, &__pyx_t_46, &__pyx_t_45);
        __Pyx_XGOTREF(__pyx_t_47);
        __Pyx_XGOTREF(__pyx_t_46);
        __Pyx_XGOTREF(__pyx_t_45);
        __Pyx_XGOTREF(__pyx_t_44);
        __Pyx_XGOTREF(__pyx_t_43);
        __Pyx_XGOTREF(__pyx_t_42);
        __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_55 = __pyx_filename;
        {
          XRRFreeMonitors(__pyx_v_monitors);
        }
        __Pyx_XGIVEREF(__pyx_t_44);
        __Pyx_XGIVEREF(__pyx_t_43);
        __Pyx_XGIVEREF(__pyx_t_42);
        __Pyx_ExceptionReset(__pyx_t_44, __pyx_t_43, __pyx_t_42);
        __Pyx_XGIVEREF(__pyx_t_47);
        __Pyx_XGIVEREF(__pyx_t_46);
        __Pyx_XGIVEREF(__pyx_t_45);
        __Pyx_ErrRestore(__pyx_t_47, __pyx_t_46, __pyx_t_45);
        __pyx_t_47 = 0; __pyx_t_46 = 0; __pyx_t_45 = 0; __pyx_t_44 = 0; __pyx_t_43 = 0; __pyx_t_42 = 0;
        __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_55;
        goto __pyx_L17_error;
      }
      __pyx_L94:;
    }

    /* "xpra/x11/bindings/randr.pyx":1343
 *                 XRRFreeMonitors(monitors)
 * 
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)             # <<<<<<<<<<<<<<
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")
*/
    __pyx_v_monitors = XRRGetMonitors(__pyx_v_self->__pyx_base.display, __pyx_v_window, 1, (&__pyx_v_nmonitors));

    /* "xpra/x11/bindings/randr.pyx":1344
 * 
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
*/
    __pyx_t_17 = (!(__pyx_v_monitors != 0));
    if (__pyx_t_17) {

      /* "xpra/x11/bindings/randr.pyx":1345
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")             # <<<<<<<<<<<<<<
 *                 return
 *             all_names = []
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_53, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1345, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_53);
      __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_53, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1345, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_22);
      __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_22))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_22);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_22);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_22, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_failed_to_retrieve_the_lis};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "xpra/x11/bindings/randr.pyx":1346
 *             if not monitors:
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return             # <<<<<<<<<<<<<<
 *             all_names = []
 *             delete = []
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L16_return;

      /* "xpra/x11/bindings/randr.pyx":1344
 * 
 *             monitors = XRRGetMonitors(self.display, window, True, &nmonitors)
 *             if not monitors:             # <<<<<<<<<<<<<<
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
*/
    }

    /* "xpra/x11/bindings/randr.pyx":1347
 *                 log.error("Error: failed to retrieve the list of monitors")
 *                 return
 *             all_names = []             # <<<<<<<<<<<<<<
 *             delete = []
 *             try:
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1347, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_all_names, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1348
 *                 return
 *             all_names = []
 *             delete = []             # <<<<<<<<<<<<<<
 *             try:
 *                 for mi in range(nmonitors):
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_delete = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/x11/bindings/randr.pyx":1349
 *             all_names = []
 *             delete = []
 *             try:             # <<<<<<<<<<<<<<
 *                 for mi in range(nmonitors):
 *                     name = self.get_atom_name(monitors[mi].name)
*/
    /*try:*/ {

      /* "xpra/x11/bindings/randr.pyx":1350
 *             delete = []
 *             try:
 *                 for mi in range(nmonitors):             # <<<<<<<<<<<<<<
 *                     name = self.get_atom_name(monitors[mi].name)
 *                     all_names.append(name)
*/
      __pyx_t_22 = NULL;
      __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_nmonitors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1350, __pyx_L110_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1350, __pyx_L110_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1350, __pyx_L110_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1350, __pyx_L110_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        {
          __pyx_t_1 = __pyx_t_19(__pyx_t_5);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1350, __pyx_L110_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF_SET(__pyx_v_mi, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":1351
 *             try:
 *                 for mi in range(nmonitors):
 *                     name = self.get_atom_name(monitors[mi].name)             # <<<<<<<<<<<<<<
 *                     all_names.append(name)
 *                     if name not in active_names:
*/
        __pyx_t_22 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_22);
        __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_mi); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1351, __pyx_L110_error)
        __pyx_t_53 = __Pyx_PyLong_From_unsigned_long((__pyx_v_monitors[__pyx_t_8]).name); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1351, __pyx_L110_error)
        __Pyx_GOTREF(__pyx_t_53);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_53};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_atom_name, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1351, __pyx_L110_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "xpra/x11/bindings/randr.pyx":1352
 *                 for mi in range(nmonitors):
 *                     name = self.get_atom_name(monitors[mi].name)
 *                     all_names.append(name)             # <<<<<<<<<<<<<<
 *                     if name not in active_names:
 *                         delete.append(name)
*/
        __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_all_names, __pyx_v_name); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1352, __pyx_L110_error)

        /* "xpra/x11/bindings/randr.pyx":1353
 *                     name = self.get_atom_name(monitors[mi].name)
 *                     all_names.append(name)
 *                     if name not in active_names:             # <<<<<<<<<<<<<<
 *                         delete.append(name)
 *             finally:
*/
        __pyx_t_17 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_active_names, Py_NE)); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(0, 1353, __pyx_L110_error)
        if (__pyx_t_17) {

          /* "xpra/x11/bindings/randr.pyx":1354
 *                     all_names.append(name)
 *                     if name not in active_names:
 *                         delete.append(name)             # <<<<<<<<<<<<<<
 *             finally:
 *                 XRRFreeMonitors(monitors)
*/
          __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_delete, __pyx_v_name); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1354, __pyx_L110_error)

          /* "xpra/x11/bindings/randr.pyx":1353
 *                     name = self.get_atom_name(monitors[mi].name)
 *                     all_names.append(name)
 *                     if name not in active_names:             # <<<<<<<<<<<<<<
 *                         delete.append(name)
 *             finally:
*/
        }

        /* "xpra/x11/bindings/randr.pyx":1350
 *             delete = []
 *             try:
 *                 for mi in range(nmonitors):             # <<<<<<<<<<<<<<
 *                     name = self.get_atom_name(monitors[mi].name)
 *                     all_names.append(name)
*/
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }

    /* "xpra/x11/bindings/randr.pyx":1356
 *                         delete.append(name)
 *             finally:
 *                 XRRFreeMonitors(monitors)             # <<<<<<<<<<<<<<
 *             self.XSync()
 *             log("active_names=%s", active_names)
*/
    /*finally:*/ {
      /*normal exit:*/{
        XRRFreeMonitors(__pyx_v_monitors);
        goto __pyx_L111;
      }
      __pyx_L110_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_42 = 0; __pyx_t_43 = 0; __pyx_t_44 = 0; __pyx_t_45 = 0; __pyx_t_46 = 0; __pyx_t_47 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
        __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_53); __pyx_t_53 = 0;
        __Pyx_XDECREF(__pyx_t_54); __pyx_t_54 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_ExceptionSwap(&__pyx_t_45, &__pyx_t_46, &__pyx_t_47);
        if ( unlikely(__Pyx_GetException(&__pyx_t_42, &__pyx_t_43, &__pyx_t_44) < 0)) __Pyx_ErrFetch(&__pyx_t_42, &__pyx_t_43, &__pyx_t_44);
        __Pyx_XGOTREF(__pyx_t_42);
        __Pyx_XGOTREF(__pyx_t_43);
        __Pyx_XGOTREF(__pyx_t_44);
        __Pyx_XGOTREF(__pyx_t_45);
        __Pyx_XGOTREF(__pyx_t_46);
        __Pyx_XGOTREF(__pyx_t_47);
        __pyx_t_11 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_56 = __pyx_filename;
        {
          XRRFreeMonitors(__pyx_v_monitors);
        }
        __Pyx_XGIVEREF(__pyx_t_45);
        __Pyx_XGIVEREF(__pyx_t_46);
        __Pyx_XGIVEREF(__pyx_t_47);
        __Pyx_ExceptionReset(__pyx_t_45, __pyx_t_46, __pyx_t_47);
        __Pyx_XGIVEREF(__pyx_t_42);
        __Pyx_XGIVEREF(__pyx_t_43);
        __Pyx_XGIVEREF(__pyx_t_44);
        __Pyx_ErrRestore(__pyx_t_42, __pyx_t_43, __pyx_t_44);
        __pyx_t_42 = 0; __pyx_t_43 = 0; __pyx_t_44 = 0; __pyx_t_45 = 0; __pyx_t_46 = 0; __pyx_t_47 = 0;
        __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_56;
        goto __pyx_L17_error;
      }
      __pyx_L111:;
    }

    /* "xpra/x11/bindings/randr.pyx":1357
 *             finally:
 *                 XRRFreeMonitors(monitors)
 *             self.XSync()             # <<<<<<<<<<<<<<
 *             log("active_names=%s", active_names)
 *             log("all names=%s", all_names)
*/
    __pyx_t_1 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_XSync, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1357, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1358
 *                 XRRFreeMonitors(monitors)
 *             self.XSync()
 *             log("active_names=%s", active_names)             # <<<<<<<<<<<<<<
 *             log("all names=%s", all_names)
 *             log("delete=%s", delete)
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_53, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1358, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_53);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_53))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_53);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_53);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_53, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_active_names_s, __pyx_v_active_names};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_53, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1358, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1359
 *             self.XSync()
 *             log("active_names=%s", active_names)
 *             log("all names=%s", all_names)             # <<<<<<<<<<<<<<
 *             log("delete=%s", delete)
 *             for name in delete:
*/
    __pyx_t_53 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1359, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_53 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_53);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_53);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_53, __pyx_mstate_global->__pyx_kp_u_all_names_s, __pyx_v_all_names};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_53); __pyx_t_53 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1359, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1360
 *             log("active_names=%s", active_names)
 *             log("all names=%s", all_names)
 *             log("delete=%s", delete)             # <<<<<<<<<<<<<<
 *             for name in delete:
 *                 atom = self.str_to_atom(name)
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_53, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1360, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_53);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_53))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_53);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_53);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_53, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_delete_s, __pyx_v_delete};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_53, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1360, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1361
 *             log("all names=%s", all_names)
 *             log("delete=%s", delete)
 *             for name in delete:             # <<<<<<<<<<<<<<
 *                 atom = self.str_to_atom(name)
 *                 XRRDeleteMonitor(self.display, window, atom)
*/
    __pyx_t_5 = __pyx_v_delete; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_8 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1361, __pyx_L17_error)
        #endif
        if (__pyx_t_8 >= __pyx_temp) break;
      }
      __pyx_t_53 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_8;
      if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1361, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_53);
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_53);
      __pyx_t_53 = 0;

      /* "xpra/x11/bindings/randr.pyx":1362
 *             log("delete=%s", delete)
 *             for name in delete:
 *                 atom = self.str_to_atom(name)             # <<<<<<<<<<<<<<
 *                 XRRDeleteMonitor(self.display, window, atom)
 *             log("status=%s", self.get_all_screen_properties())
*/
      __pyx_t_51 = ((struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.str_to_atom(((struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance *)__pyx_v_self), __pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1362, __pyx_L17_error)
      __pyx_v_atom = __pyx_t_51;

      /* "xpra/x11/bindings/randr.pyx":1363
 *             for name in delete:
 *                 atom = self.str_to_atom(name)
 *                 XRRDeleteMonitor(self.display, window, atom)             # <<<<<<<<<<<<<<
 *             log("status=%s", self.get_all_screen_properties())
 *             self.XSync()
*/
      XRRDeleteMonitor(__pyx_v_self->__pyx_base.display, __pyx_v_window, __pyx_v_atom);

      /* "xpra/x11/bindings/randr.pyx":1361
 *             log("all names=%s", all_names)
 *             log("delete=%s", delete)
 *             for name in delete:             # <<<<<<<<<<<<<<
 *                 atom = self.str_to_atom(name)
 *                 XRRDeleteMonitor(self.display, window, atom)
*/
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1364
 *                 atom = self.str_to_atom(name)
 *                 XRRDeleteMonitor(self.display, window, atom)
 *             log("status=%s", self.get_all_screen_properties())             # <<<<<<<<<<<<<<
 *             self.XSync()
 *         finally:
*/
    __pyx_t_53 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1364, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_22 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_all_screen_properties, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1364, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_22);
    }
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_53 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_53);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_53);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_53, __pyx_mstate_global->__pyx_kp_u_status_s, __pyx_t_22};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_53); __pyx_t_53 = 0;
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1364, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/x11/bindings/randr.pyx":1365
 *                 XRRDeleteMonitor(self.display, window, atom)
 *             log("status=%s", self.get_all_screen_properties())
 *             self.XSync()             # <<<<<<<<<<<<<<
 *         finally:
 *             XRRFreeScreenResources(rsc)
*/
    __pyx_t_1 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_XSync, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1365, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "xpra/x11/bindings/randr.pyx":1367
 *             self.XSync()
 *         finally:
 *             XRRFreeScreenResources(rsc)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      XRRFreeScreenResources(__pyx_v_rsc);
      goto __pyx_L18;
    }
    __pyx_L17_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_47 = 0; __pyx_t_46 = 0; __pyx_t_45 = 0; __pyx_t_44 = 0; __pyx_t_43 = 0; __pyx_t_42 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
      __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_53); __pyx_t_53 = 0;
      __Pyx_XDECREF(__pyx_t_54); __pyx_t_54 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_44, &__pyx_t_43, &__pyx_t_42);
      if ( unlikely(__Pyx_GetException(&__pyx_t_47, &__pyx_t_46, &__pyx_t_45) < 0)) __Pyx_ErrFetch(&__pyx_t_47, &__pyx_t_46, &__pyx_t_45);
      __Pyx_XGOTREF(__pyx_t_47);
      __Pyx_XGOTREF(__pyx_t_46);
      __Pyx_XGOTREF(__pyx_t_45);
      __Pyx_XGOTREF(__pyx_t_44);
      __Pyx_XGOTREF(__pyx_t_43);
      __Pyx_XGOTREF(__pyx_t_42);
      __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_57 = __pyx_filename;
      {
        XRRFreeScreenResources(__pyx_v_rsc);
      }
      __Pyx_XGIVEREF(__pyx_t_44);
      __Pyx_XGIVEREF(__pyx_t_43);
      __Pyx_XGIVEREF(__pyx_t_42);
      __Pyx_ExceptionReset(__pyx_t_44, __pyx_t_43, __pyx_t_42);
      __Pyx_XGIVEREF(__pyx_t_47);
      __Pyx_XGIVEREF(__pyx_t_46);
      __Pyx_XGIVEREF(__pyx_t_45);
      __Pyx_ErrRestore(__pyx_t_47, __pyx_t_46, __pyx_t_45);
      __pyx_t_47 = 0; __pyx_t_46 = 0; __pyx_t_45 = 0; __pyx_t_44 = 0; __pyx_t_43 = 0; __pyx_t_42 = 0;
      __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_57;
      goto __pyx_L1_error;
    }
    __pyx_L16_return: {
      __pyx_t_42 = __pyx_r;
      __pyx_r = 0;
      XRRFreeScreenResources(__pyx_v_rsc);
      __pyx_r = __pyx_t_42;
      __pyx_t_42 = 0;
      goto __pyx_L0;
    }
    __pyx_L18:;
  }

  /* "xpra/x11/bindings/randr.pyx":1091
 *         self.XSync()
 * 
 *     def set_crtc_config(self, monitor_defs: Dict) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_XDECREF(__pyx_t_37);
  __Pyx_XDECREF(__pyx_t_38);
  __Pyx_XDECREF(__pyx_t_53);
  __Pyx_XDECREF(__pyx_t_54);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindingsInstance.set_crtc_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dpi96);
  __Pyx_XDECREF(__pyx_v_screen_w);
  __Pyx_XDECREF(__pyx_v_screen_h);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_width);
  __Pyx_XDECREF(__pyx_v_height);
  __Pyx_XDECREF(__pyx_v_root_w);
  __Pyx_XDECREF(__pyx_v_root_h);
  __Pyx_XDECREF(__pyx_v_output_names);
  __Pyx_XDECREF(__pyx_v_new_modes);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_vrefresh);
  __Pyx_XDECREF(__pyx_v_hz);
  __Pyx_XDECREF(__pyx_v_hzstr);
  __Pyx_XDECREF(__pyx_v_mode_name);
  __Pyx_XDECREF(__pyx_v_rotation_int);
  __Pyx_XDECREF(__pyx_v_rotation);
  __Pyx_XDECREF(__pyx_v_mmw);
  __Pyx_XDECREF(__pyx_v_mmh);
  __Pyx_XDECREF(__pyx_v_posinfo);
  __Pyx_XDECREF(__pyx_v_dpiinfo);
  __Pyx_XDECREF(__pyx_v_dpix);
  __Pyx_XDECREF(__pyx_v_dpiy);
  __Pyx_XDECREF(__pyx_v_dpi);
  __Pyx_XDECREF(__pyx_v_mi);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_monitor_names);
  __Pyx_XDECREF(__pyx_v_all_names);
  __Pyx_XDECREF(__pyx_v_active_names);
  __Pyx_XDECREF(__pyx_v_ext_chars);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XDECREF(__pyx_v_basename);
  __Pyx_XDECREF(__pyx_v_ext);
  __Pyx_XDECREF(__pyx_v_delete);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1370
 * 
 * 
 * cdef dict parse_ScreenChangeNotify(Display *d, XEvent *e):             # <<<<<<<<<<<<<<
 *     cdef XRRScreenChangeNotifyEvent *scn_e = <XRRScreenChangeNotifyEvent*> e
 *     return {
*/

static PyObject *__pyx_f_4xpra_3x11_8bindings_5randr_parse_ScreenChangeNotify(CYTHON_UNUSED Display *__pyx_v_d, XEvent *__pyx_v_e) {
  XRRScreenChangeNotifyEvent *__pyx_v_scn_e;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_ScreenChangeNotify", 0);

  /* "xpra/x11/bindings/randr.pyx":1371
 * 
 * cdef dict parse_ScreenChangeNotify(Display *d, XEvent *e):
 *     cdef XRRScreenChangeNotifyEvent *scn_e = <XRRScreenChangeNotifyEvent*> e             # <<<<<<<<<<<<<<
 *     return {
 *         "window": scn_e.window,
*/
  __pyx_v_scn_e = ((XRRScreenChangeNotifyEvent *)__pyx_v_e);

  /* "xpra/x11/bindings/randr.pyx":1372
 * cdef dict parse_ScreenChangeNotify(Display *d, XEvent *e):
 *     cdef XRRScreenChangeNotifyEvent *scn_e = <XRRScreenChangeNotifyEvent*> e
 *     return {             # <<<<<<<<<<<<<<
 *         "window": scn_e.window,
 *         "root": scn_e.root,
*/
  __Pyx_XDECREF(__pyx_r);

  /* "xpra/x11/bindings/randr.pyx":1373
 *     cdef XRRScreenChangeNotifyEvent *scn_e = <XRRScreenChangeNotifyEvent*> e
 *     return {
 *         "window": scn_e.window,             # <<<<<<<<<<<<<<
 *         "root": scn_e.root,
 *         "config_timestamp": int(scn_e.config_timestamp),
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_scn_e->window); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_window, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1374
 *     return {
 *         "window": scn_e.window,
 *         "root": scn_e.root,             # <<<<<<<<<<<<<<
 *         "config_timestamp": int(scn_e.config_timestamp),
 *         "size_index": int(scn_e.size_index),
*/
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_scn_e->root); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_root, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1375
 *         "window": scn_e.window,
 *         "root": scn_e.root,
 *         "config_timestamp": int(scn_e.config_timestamp),             # <<<<<<<<<<<<<<
 *         "size_index": int(scn_e.size_index),
 *         "subpixel_order": int(scn_e.subpixel_order),
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = __Pyx_PyLong_From_unsigned_long(__pyx_v_scn_e->config_timestamp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_config_timestamp_2, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1376
 *         "root": scn_e.root,
 *         "config_timestamp": int(scn_e.config_timestamp),
 *         "size_index": int(scn_e.size_index),             # <<<<<<<<<<<<<<
 *         "subpixel_order": int(scn_e.subpixel_order),
 *         "rotation": int(scn_e.rotation),
*/
  __pyx_t_4 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_unsigned_short(__pyx_v_scn_e->size_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_size_index, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1377
 *         "config_timestamp": int(scn_e.config_timestamp),
 *         "size_index": int(scn_e.size_index),
 *         "subpixel_order": int(scn_e.subpixel_order),             # <<<<<<<<<<<<<<
 *         "rotation": int(scn_e.rotation),
 *         "width": int(scn_e.width),
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = __Pyx_PyLong_From_SubpixelOrder(__pyx_v_scn_e->subpixel_order); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_subpixel_order_2, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1378
 *         "size_index": int(scn_e.size_index),
 *         "subpixel_order": int(scn_e.subpixel_order),
 *         "rotation": int(scn_e.rotation),             # <<<<<<<<<<<<<<
 *         "width": int(scn_e.width),
 *         "height": int(scn_e.height),
*/
  __pyx_t_4 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_Rotation(__pyx_v_scn_e->rotation); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_rotation, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1379
 *         "subpixel_order": int(scn_e.subpixel_order),
 *         "rotation": int(scn_e.rotation),
 *         "width": int(scn_e.width),             # <<<<<<<<<<<<<<
 *         "height": int(scn_e.height),
 *         "mwidth": int(scn_e.mwidth),
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_scn_e->width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_width, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1380
 *         "rotation": int(scn_e.rotation),
 *         "width": int(scn_e.width),
 *         "height": int(scn_e.height),             # <<<<<<<<<<<<<<
 *         "mwidth": int(scn_e.mwidth),
 *         "mheight": int(scn_e.mheight),
*/
  __pyx_t_4 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_scn_e->height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_height, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1381
 *         "width": int(scn_e.width),
 *         "height": int(scn_e.height),
 *         "mwidth": int(scn_e.mwidth),             # <<<<<<<<<<<<<<
 *         "mheight": int(scn_e.mheight),
 *     }
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_scn_e->mwidth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_mwidth, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1382
 *         "height": int(scn_e.height),
 *         "mwidth": int(scn_e.mwidth),
 *         "mheight": int(scn_e.mheight),             # <<<<<<<<<<<<<<
 *     }
 * 
*/
  __pyx_t_4 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_scn_e->mheight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyLong_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_mheight, __pyx_t_2) < (0)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":1370
 * 
 * 
 * cdef dict parse_ScreenChangeNotify(Display *d, XEvent *e):             # <<<<<<<<<<<<<<
 *     cdef XRRScreenChangeNotifyEvent *scn_e = <XRRScreenChangeNotifyEvent*> e
 *     return {
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.parse_ScreenChangeNotify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1386
 * 
 * 
 * def init_xrandr_events() -> bool:             # <<<<<<<<<<<<<<
 *     cdef Display *display = get_display()
 *     cdef int event_base = 0
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_7init_xrandr_events(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_7init_xrandr_events = {"init_xrandr_events", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_7init_xrandr_events, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_3x11_8bindings_5randr_7init_xrandr_events(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_xrandr_events (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_6init_xrandr_events(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_3x11_8bindings_5randr_6init_xrandr_events(CYTHON_UNUSED PyObject *__pyx_self) {
  Display *__pyx_v_display;
  int __pyx_v_event_base;
  int __pyx_v_error_base;
  int __pyx_v_ScreenChangeNotify;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_xrandr_events", 0);

  /* "xpra/x11/bindings/randr.pyx":1387
 * 
 * def init_xrandr_events() -> bool:
 *     cdef Display *display = get_display()             # <<<<<<<<<<<<<<
 *     cdef int event_base = 0
 *     cdef int error_base = 0
*/
  __pyx_v_display = __pyx_f_4xpra_3x11_8bindings_14display_source_get_display();

  /* "xpra/x11/bindings/randr.pyx":1388
 * def init_xrandr_events() -> bool:
 *     cdef Display *display = get_display()
 *     cdef int event_base = 0             # <<<<<<<<<<<<<<
 *     cdef int error_base = 0
 *     if not XRRQueryExtension(display, &event_base, &error_base):
*/
  __pyx_v_event_base = 0;

  /* "xpra/x11/bindings/randr.pyx":1389
 *     cdef Display *display = get_display()
 *     cdef int event_base = 0
 *     cdef int error_base = 0             # <<<<<<<<<<<<<<
 *     if not XRRQueryExtension(display, &event_base, &error_base):
 *         log.warn("Warning: XRandR extension is not available")
*/
  __pyx_v_error_base = 0;

  /* "xpra/x11/bindings/randr.pyx":1390
 *     cdef int event_base = 0
 *     cdef int error_base = 0
 *     if not XRRQueryExtension(display, &event_base, &error_base):             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR extension is not available")
 *         return False
*/
  __pyx_t_1 = (!(XRRQueryExtension(__pyx_v_display, (&__pyx_v_event_base), (&__pyx_v_error_base)) != 0));
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":1391
 *     cdef int error_base = 0
 *     if not XRRQueryExtension(display, &event_base, &error_base):
 *         log.warn("Warning: XRandR extension is not available")             # <<<<<<<<<<<<<<
 *         return False
 *     if event_base <= 0:
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Warning_XRandR_extension_is_not};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1391, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":1392
 *     if not XRRQueryExtension(display, &event_base, &error_base):
 *         log.warn("Warning: XRandR extension is not available")
 *         return False             # <<<<<<<<<<<<<<
 *     if event_base <= 0:
 *         log.warn("Warning: XRandR extension returned invalid event base: %d", event_base)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1390
 *     cdef int event_base = 0
 *     cdef int error_base = 0
 *     if not XRRQueryExtension(display, &event_base, &error_base):             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR extension is not available")
 *         return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1393
 *         log.warn("Warning: XRandR extension is not available")
 *         return False
 *     if event_base <= 0:             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR extension returned invalid event base: %d", event_base)
 *         return False
*/
  __pyx_t_1 = (__pyx_v_event_base <= 0);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":1394
 *         return False
 *     if event_base <= 0:
 *         log.warn("Warning: XRandR extension returned invalid event base: %d", event_base)             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_event_base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Warning_XRandR_extension_returne, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1394, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":1395
 *     if event_base <= 0:
 *         log.warn("Warning: XRandR extension returned invalid event base: %d", event_base)
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef int ScreenChangeNotify = event_base + RRScreenChangeNotify
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "xpra/x11/bindings/randr.pyx":1393
 *         log.warn("Warning: XRandR extension is not available")
 *         return False
 *     if event_base <= 0:             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR extension returned invalid event base: %d", event_base)
 *         return False
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1397
 *         return False
 * 
 *     cdef int ScreenChangeNotify = event_base + RRScreenChangeNotify             # <<<<<<<<<<<<<<
 *     add_event_type(ScreenChangeNotify, "ScreenChangeNotify", "x11-screen-change-event", "")
 *     add_parser(ScreenChangeNotify, parse_ScreenChangeNotify)
*/
  __pyx_v_ScreenChangeNotify = (__pyx_v_event_base + RRScreenChangeNotify);

  /* "xpra/x11/bindings/randr.pyx":1398
 * 
 *     cdef int ScreenChangeNotify = event_base + RRScreenChangeNotify
 *     add_event_type(ScreenChangeNotify, "ScreenChangeNotify", "x11-screen-change-event", "")             # <<<<<<<<<<<<<<
 *     add_parser(ScreenChangeNotify, parse_ScreenChangeNotify)
 *     log("ScreenChangeNotify=%d", ScreenChangeNotify)
*/
  __pyx_f_4xpra_3x11_8bindings_6events_add_event_type(__pyx_v_ScreenChangeNotify, __pyx_mstate_global->__pyx_n_u_ScreenChangeNotify, __pyx_mstate_global->__pyx_kp_u_x11_screen_change_event, __pyx_mstate_global->__pyx_kp_u_);

  /* "xpra/x11/bindings/randr.pyx":1399
 *     cdef int ScreenChangeNotify = event_base + RRScreenChangeNotify
 *     add_event_type(ScreenChangeNotify, "ScreenChangeNotify", "x11-screen-change-event", "")
 *     add_parser(ScreenChangeNotify, parse_ScreenChangeNotify)             # <<<<<<<<<<<<<<
 *     log("ScreenChangeNotify=%d", ScreenChangeNotify)
 * 
*/
  __pyx_f_4xpra_3x11_8bindings_6events_add_parser(__pyx_v_ScreenChangeNotify, __pyx_f_4xpra_3x11_8bindings_5randr_parse_ScreenChangeNotify);

  /* "xpra/x11/bindings/randr.pyx":1400
 *     add_event_type(ScreenChangeNotify, "ScreenChangeNotify", "x11-screen-change-event", "")
 *     add_parser(ScreenChangeNotify, parse_ScreenChangeNotify)
 *     log("ScreenChangeNotify=%d", ScreenChangeNotify)             # <<<<<<<<<<<<<<
 * 
 *     return True
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_ScreenChangeNotify); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_ScreenChangeNotify_d, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1402
 *     log("ScreenChangeNotify=%d", ScreenChangeNotify)
 * 
 *     return True             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":1386
 * 
 * 
 * def init_xrandr_events() -> bool:             # <<<<<<<<<<<<<<
 *     cdef Display *display = get_display()
 *     cdef int event_base = 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.init_xrandr_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/x11/bindings/randr.pyx":1408
 * 
 * 
 * def RandRBindings() -> RandRBindingsInstance:             # <<<<<<<<<<<<<<
 *     global singleton
 *     if singleton is None:
*/

/* Python wrapper */
static struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_pw_4xpra_3x11_8bindings_5randr_9RandRBindings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_3x11_8bindings_5randr_9RandRBindings = {"RandRBindings", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_9RandRBindings, METH_NOARGS, 0};
static struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_pw_4xpra_3x11_8bindings_5randr_9RandRBindings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RandRBindings (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_3x11_8bindings_5randr_8RandRBindings(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_pf_4xpra_3x11_8bindings_5randr_8RandRBindings(CYTHON_UNUSED PyObject *__pyx_self) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("RandRBindings", 0);

  /* "xpra/x11/bindings/randr.pyx":1410
 * def RandRBindings() -> RandRBindingsInstance:
 *     global singleton
 *     if singleton is None:             # <<<<<<<<<<<<<<
 *         singleton = RandRBindingsInstance()
 *     return singleton
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_4xpra_3x11_8bindings_5randr_singleton) == Py_None);
  if (__pyx_t_1) {

    /* "xpra/x11/bindings/randr.pyx":1411
 *     global singleton
 *     if singleton is None:
 *         singleton = RandRBindingsInstance()             # <<<<<<<<<<<<<<
 *     return singleton
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_XGOTREF((PyObject *)__pyx_v_4xpra_3x11_8bindings_5randr_singleton);
    __Pyx_DECREF_SET(__pyx_v_4xpra_3x11_8bindings_5randr_singleton, ((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)__pyx_t_2));
    __Pyx_GIVEREF((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "xpra/x11/bindings/randr.pyx":1410
 * def RandRBindings() -> RandRBindingsInstance:
 *     global singleton
 *     if singleton is None:             # <<<<<<<<<<<<<<
 *         singleton = RandRBindingsInstance()
 *     return singleton
*/
  }

  /* "xpra/x11/bindings/randr.pyx":1412
 *     if singleton is None:
 *         singleton = RandRBindingsInstance()
 *     return singleton             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_4xpra_3x11_8bindings_5randr_singleton);
  __pyx_r = __pyx_v_4xpra_3x11_8bindings_5randr_singleton;
  goto __pyx_L0;

  /* "xpra/x11/bindings/randr.pyx":1408
 * 
 * 
 * def RandRBindings() -> RandRBindingsInstance:             # <<<<<<<<<<<<<<
 *     global singleton
 *     if singleton is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("xpra.x11.bindings.randr.RandRBindings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */
static struct __pyx_vtabstruct_4xpra_3x11_8bindings_5randr_RandRBindingsInstance __pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr_RandRBindingsInstance(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *p;
  PyObject *o = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance, tp_new, newfunc)(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance*)__pyx_vtabptr_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;
  p->_added_modes = Py_None; Py_INCREF(Py_None);
  p->version = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr_RandRBindingsInstance(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr_RandRBindingsInstance) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_added_modes);
  Py_CLEAR(p->version);
  if (PyType_IS_GC(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance)) PyObject_GC_Track(o);
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance)) __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance, tp_dealloc, destructor)(o); else
  #endif
  __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr_RandRBindingsInstance);
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr_RandRBindingsInstance(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4xpra_3x11_8bindings_5randr_RandRBindingsInstance); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->_added_modes) {
    e = (*v)(p->_added_modes, a); if (e) return e;
  }
  if (p->version) {
    e = (*v)(p->version, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4xpra_3x11_8bindings_5randr_RandRBindingsInstance(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4xpra_3x11_8bindings_5randr_RandRBindingsInstance); }
  tmp = ((PyObject*)p->_added_modes);
  p->_added_modes = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->version);
  p->version = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4xpra_3x11_8bindings_5randr_RandRBindingsInstance[] = {
  {"get_version", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_5get_version, METH_NOARGS, 0},
  {"check_randr_sizes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_7check_randr_sizes, METH_NOARGS, 0},
  {"has_randr", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_9has_randr, METH_NOARGS, 0},
  {"select_screen_changes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_11select_screen_changes, METH_NOARGS, 0},
  {"select_crtc_output_changes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_13select_crtc_output_changes, METH_NOARGS, 0},
  {"get_xrr_screen_sizes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15get_xrr_screen_sizes, METH_NOARGS, 0},
  {"get_screen_count", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_17get_screen_count, METH_NOARGS, 0},
  {"get_screen_size_mm", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_19get_screen_size_mm, METH_NOARGS, 0},
  {"get_screen_sizes_mm", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_21get_screen_sizes_mm, METH_NOARGS, 0},
  {"get_screen_sizes", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_23get_screen_sizes, METH_NOARGS, 0},
  {"get_screen_size", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_25get_screen_size, METH_NOARGS, 0},
  {"get_screen_size_range", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_27get_screen_size_range, METH_NOARGS, 0},
  {"get_vrefresh", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_29get_vrefresh, METH_NOARGS, 0},
  {"get_vrefresh_display", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_31get_vrefresh_display, METH_NOARGS, 0},
  {"get_vrefresh_outputs", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_33get_vrefresh_outputs, METH_NOARGS, 0},
  {"set_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_35set_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"add_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_37add_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"remove_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_39remove_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"remove_mode", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_41remove_mode, METH_O, 0},
  {"xrr_set_screen_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_43xrr_set_screen_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"is_dummy16", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_45is_dummy16, METH_NOARGS, 0},
  {"get_monitor_properties", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_47get_monitor_properties, METH_NOARGS, 0},
  {"get_all_screen_properties", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_49get_all_screen_properties, METH_NOARGS, 0},
  {"set_output_int_property", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_51set_output_int_property, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"has_mode", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_53has_mode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"DeleteMonitor", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_55DeleteMonitor, METH_O, 0},
  {"set_crtc_config", (PyCFunction)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_57set_crtc_config, METH_O, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr_RandRBindingsInstance},
  {Py_tp_repr, (void *)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_3__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr_RandRBindingsInstance},
  {Py_tp_clear, (void *)__pyx_tp_clear_4xpra_3x11_8bindings_5randr_RandRBindingsInstance},
  {Py_tp_methods, (void *)__pyx_methods_4xpra_3x11_8bindings_5randr_RandRBindingsInstance},
  {Py_tp_init, (void *)__pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr_RandRBindingsInstance},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance_spec = {
  "xpra.x11.bindings.randr.RandRBindingsInstance",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""RandRBindingsInstance", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, /*tp_traverse*/
  __pyx_tp_clear_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_name);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_name) {
    e = (*v)(p->__pyx_v_name, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_1_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_3_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_5_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_7_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_8_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_8_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_9_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_9_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_10_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_10_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_12_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_12_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr[--__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr(PyObject *o) {
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_h);
  Py_CLEAR(p->__pyx_v_w);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr, sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr[__pyx_mstate_global->__pyx_freecount_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr++] = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_h) {
    e = (*v)(p->__pyx_v_h, a); if (e) return e;
  }
  if (p->__pyx_v_w) {
    e = (*v)(p->__pyx_v_w, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr_spec = {
  "xpra.x11.bindings.randr.__pyx_scope_struct_13_genexpr",
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.x11.bindings.randr.""__pyx_scope_struct_13_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};
/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_shared_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_shared_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_shared_function_import_code", 0);
  /*--- Shared function import code ---*/
  {
    __pyx_t_1 = PyImport_ImportModule("xpra.cyshared"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject_name_PyObject);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 952;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__Pyx__Import, (void (**)(void))&__Pyx_PyUnicode_Join, (void (**)(void))&__Pyx_ParseKeywordsTuple, (void (**)(void))&__Pyx_ParseKeywordDictToDict, (void (**)(void))&__Pyx_ParseKeywordDict, (void (**)(void))&__Pyx__ArgTypeTest, (void (**)(void))&__Pyx_Raise, (void (**)(void))&__Pyx_RejectKeywords, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_4(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_4xpra_3x11_8bindings_5randr_singleton = ((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)Py_None); Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  {
    __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_Display_get_all_screen);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_export_name = __pyx_export_signature + 22;
    void (*const __pyx_export_pointers[])(void) = {(void (*)(void))&__pyx_f_4xpra_3x11_8bindings_5randr_get_all_screen_properties, (void (*)(void)) NULL};
    void (*const *__pyx_export_pointer)(void) = __pyx_export_pointers;
    const char *__pyx_export_current_signature = __pyx_export_signature;
    while (*__pyx_export_pointer) {
      if (__Pyx_ExportFunction(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_export_pointer;
      __pyx_export_name = strchr(__pyx_export_name, '\0') + 1;
      __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1;
      if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_t_1 = PyImport_ImportModule("xpra.x11.bindings.core"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance = __Pyx_ImportType_3_2_4(__pyx_t_1, "xpra.x11.bindings.core", "X11CoreBindingsInstance",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance),
  #else
  sizeof(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(struct __pyx_obj_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_4); if (!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance = (struct __pyx_vtabstruct_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance); if (unlikely(!__pyx_vtabptr_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_4xpra_3x11_8bindings_5randr_RandRBindingsInstance = &__pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;
  __pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance.__pyx_base = *__pyx_vtabptr_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance;
  __pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance._get_xrr_screen_sizes = (PyObject *(*)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *))__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance__get_xrr_screen_sizes;
  __pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance._set_screen_size = (int (*)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *, PyObject *, PyObject *))__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance__set_screen_size;
  __pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance.add_screen_mode = (RRMode (*)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *, PyObject *, unsigned int, unsigned int, double))__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_add_screen_mode;
  __pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance.calculate_mode = (XRRModeInfo *(*)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *, PyObject *, unsigned int, unsigned int, double))__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_calculate_mode;
  __pyx_vtable_4xpra_3x11_8bindings_5randr_RandRBindingsInstance.get_current_output = (RROutput (*)(struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *))__pyx_f_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_get_current_output;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance_spec, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance)) __PYX_ERR(0, 603, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance) < (0)) __PYX_ERR(0, 603, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance = &__pyx_type_4xpra_3x11_8bindings_5randr_RandRBindingsInstance;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance->tp_base = __pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_4core_X11CoreBindingsInstance;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance) < (0)) __PYX_ERR(0, 603, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_vtabptr_4xpra_3x11_8bindings_5randr_RandRBindingsInstance) < (0)) __PYX_ERR(0, 603, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance) < (0)) __PYX_ERR(0, 603, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance, (PyObject *) __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance) < (0)) __PYX_ERR(0, 603, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info)) __PYX_ERR(0, 328, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info) < (0)) __PYX_ERR(0, 328, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info) < (0)) __PYX_ERR(0, 328, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct____pyx_f_4xpra_3x11_8bindings_5randr_get_mode_info->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 346, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 346, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 346, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info)) __PYX_ERR(0, 351, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info) < (0)) __PYX_ERR(0, 351, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info) < (0)) __PYX_ERR(0, 351, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_2___pyx_f_4xpra_3x11_8bindings_5randr_get_output_info->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 371, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 371, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 371, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties)) __PYX_ERR(0, 396, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties) < (0)) __PYX_ERR(0, 396, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties) < (0)) __PYX_ERR(0, 396, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_4___pyx_f_4xpra_3x11_8bindings_5randr_get_output_properties->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr)) __PYX_ERR(0, 448, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 448, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 448, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_5_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info)) __PYX_ERR(0, 509, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info) < (0)) __PYX_ERR(0, 509, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info) < (0)) __PYX_ERR(0, 509, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_6___pyx_f_4xpra_3x11_8bindings_5randr_get_crtc_info->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr)) __PYX_ERR(0, 518, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr) < (0)) __PYX_ERR(0, 518, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr) < (0)) __PYX_ERR(0, 518, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_7_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr)) __PYX_ERR(0, 534, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_8_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr)) __PYX_ERR(0, 535, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr) < (0)) __PYX_ERR(0, 535, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr) < (0)) __PYX_ERR(0, 535, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_9_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr)) __PYX_ERR(0, 536, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr) < (0)) __PYX_ERR(0, 536, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr) < (0)) __PYX_ERR(0, 536, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_10_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties)) __PYX_ERR(0, 562, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties) < (0)) __PYX_ERR(0, 562, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties) < (0)) __PYX_ERR(0, 562, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_11___pyx_f_4xpra_3x11_8bindings_5randr__monitor_properties->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr)) __PYX_ERR(0, 574, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr) < (0)) __PYX_ERR(0, 574, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr) < (0)) __PYX_ERR(0, 574, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_12_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr)) __PYX_ERR(0, 713, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr_spec, __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr) < (0)) __PYX_ERR(0, 713, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr = &__pyx_type_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr) < (0)) __PYX_ERR(0, 713, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_3x11_8bindings_5randr___pyx_scope_struct_13_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  {
    __pyx_t_1 = PyImport_ImportModule("xpra.x11.bindings.core"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_void_PyObject_import_check);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 18;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4xpra_3x11_8bindings_4core_import_check, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_4(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("xpra.x11.bindings.display_source"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_Display_void_get_display);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 16;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4xpra_3x11_8bindings_14display_source_get_display, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_4(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("xpra.x11.bindings.events"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_void_int_PyObject_PyObject_PyObj);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 118;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4xpra_3x11_8bindings_6events_add_event_type, (void (**)(void))&__pyx_f_4xpra_3x11_8bindings_6events_add_parser, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_4(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_randr(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_randr},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "randr",
      0, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      NULL /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      NULL /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit_randr(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_randr(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
    PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_randr(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  unsigned int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'randr' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "randr" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
    PyErr_Clear();
    __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
    if (!__Pyx_RefNanny)
        Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  
__Pyx_RefNannySetupContext("PyInit_randr", 0);
  __Pyx_init_runtime_version();
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_xpra__x11__bindings__randr) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "xpra.x11.bindings.randr")) {
      if (unlikely((PyDict_SetItemString(modules, "xpra.x11.bindings.randr", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_function_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_type_import_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_shared_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/

  /* "xpra/x11/bindings/randr.pyx":7
 * # later version. See the file COPYING for details.
 * 
 * import struct             # <<<<<<<<<<<<<<
 * from typing import Dict, List, Tuple
 * from time import monotonic
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_struct, __pyx_t_2) < (0)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":8
 * 
 * import struct
 * from typing import Dict, List, Tuple             # <<<<<<<<<<<<<<
 * from time import monotonic
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Dict,__pyx_mstate_global->__pyx_n_u_List,__pyx_mstate_global->__pyx_n_u_Tuple};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 3, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Dict,__pyx_mstate_global->__pyx_n_u_List,__pyx_mstate_global->__pyx_n_u_Tuple};
    for (__pyx_t_3=0; __pyx_t_3 < 3; __pyx_t_3++) {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 8, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":9
 * import struct
 * from typing import Dict, List, Tuple
 * from time import monotonic             # <<<<<<<<<<<<<<
 * 
 * from libc.string cimport memset
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_monotonic};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_time, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_monotonic};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 9, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":24
 * from xpra.x11.bindings.events cimport add_parser, add_event_type
 * 
 * from xpra.common import DEFAULT_REFRESH_RATE             # <<<<<<<<<<<<<<
 * from xpra.util.env import envint, envbool, first_time
 * from xpra.util.str_fn import csv, decode_str
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DEFAULT_REFRESH_RATE};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_common, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DEFAULT_REFRESH_RATE};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 24, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":25
 * 
 * from xpra.common import DEFAULT_REFRESH_RATE
 * from xpra.util.env import envint, envbool, first_time             # <<<<<<<<<<<<<<
 * from xpra.util.str_fn import csv, decode_str
 * from xpra.util.screen import prettify_plug_name
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_envint,__pyx_mstate_global->__pyx_n_u_envbool,__pyx_mstate_global->__pyx_n_u_first_time};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_util_env, __pyx_imported_names, 3, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_envint,__pyx_mstate_global->__pyx_n_u_envbool,__pyx_mstate_global->__pyx_n_u_first_time};
    for (__pyx_t_3=0; __pyx_t_3 < 3; __pyx_t_3++) {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 25, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":26
 * from xpra.common import DEFAULT_REFRESH_RATE
 * from xpra.util.env import envint, envbool, first_time
 * from xpra.util.str_fn import csv, decode_str             # <<<<<<<<<<<<<<
 * from xpra.util.screen import prettify_plug_name
 * from xpra.log import Logger
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_csv,__pyx_mstate_global->__pyx_n_u_decode_str};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_util_str_fn, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_csv,__pyx_mstate_global->__pyx_n_u_decode_str};
    for (__pyx_t_3=0; __pyx_t_3 < 2; __pyx_t_3++) {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 26, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":27
 * from xpra.util.env import envint, envbool, first_time
 * from xpra.util.str_fn import csv, decode_str
 * from xpra.util.screen import prettify_plug_name             # <<<<<<<<<<<<<<
 * from xpra.log import Logger
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_prettify_plug_name};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_util_screen, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_prettify_plug_name};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 27, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":28
 * from xpra.util.str_fn import csv, decode_str
 * from xpra.util.screen import prettify_plug_name
 * from xpra.log import Logger             # <<<<<<<<<<<<<<
 * 
 * log = Logger("x11", "bindings", "randr")
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Logger};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_log, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Logger};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 28, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":30
 * from xpra.log import Logger
 * 
 * log = Logger("x11", "bindings", "randr")             # <<<<<<<<<<<<<<
 * 
 * import_check("randr")
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[10], NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_log, __pyx_t_4) < (0)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":32
 * log = Logger("x11", "bindings", "randr")
 * 
 * import_check("randr")             # <<<<<<<<<<<<<<
 * 
 * TIMESTAMPS = envbool("XPRA_RANDR_TIMESTAMPS", False)
*/
  __pyx_f_4xpra_3x11_8bindings_4core_import_check(__pyx_mstate_global->__pyx_n_u_randr); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 32, __pyx_L1_error)

  /* "xpra/x11/bindings/randr.pyx":34
 * import_check("randr")
 * 
 * TIMESTAMPS = envbool("XPRA_RANDR_TIMESTAMPS", False)             # <<<<<<<<<<<<<<
 * GAMMA = envbool("XPRA_RANDR_GAMMA", False)
 * MAX_NEW_MODES = envint("XPRA_RANDR_MAX_NEW_MODES", 32)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_envbool); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[11], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_TIMESTAMPS, __pyx_t_2) < (0)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":35
 * 
 * TIMESTAMPS = envbool("XPRA_RANDR_TIMESTAMPS", False)
 * GAMMA = envbool("XPRA_RANDR_GAMMA", False)             # <<<<<<<<<<<<<<
 * MAX_NEW_MODES = envint("XPRA_RANDR_MAX_NEW_MODES", 32)
 * assert MAX_NEW_MODES>=2
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_envbool); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[12], NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GAMMA, __pyx_t_4) < (0)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":36
 * TIMESTAMPS = envbool("XPRA_RANDR_TIMESTAMPS", False)
 * GAMMA = envbool("XPRA_RANDR_GAMMA", False)
 * MAX_NEW_MODES = envint("XPRA_RANDR_MAX_NEW_MODES", 32)             # <<<<<<<<<<<<<<
 * assert MAX_NEW_MODES>=2
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_envint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[13], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MAX_NEW_MODES, __pyx_t_2) < (0)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":37
 * GAMMA = envbool("XPRA_RANDR_GAMMA", False)
 * MAX_NEW_MODES = envint("XPRA_RANDR_MAX_NEW_MODES", 32)
 * assert MAX_NEW_MODES>=2             # <<<<<<<<<<<<<<
 * 
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_MAX_NEW_MODES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_mstate_global->__pyx_int_2, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 37, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 37, __pyx_L1_error)
  #endif

  /* "xpra/x11/bindings/randr.pyx":84
 * 
 * MODE_FLAGS_STR: Dict[int, str] = {
 *     RR_HSyncPositive    : "HSyncPositive",             # <<<<<<<<<<<<<<
 *     RR_HSyncNegative    : "HSyncNegative",
 *     RR_VSyncPositive    : "VSyncPositive",
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_HSyncPositive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_HSyncPositive) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":85
 * MODE_FLAGS_STR: Dict[int, str] = {
 *     RR_HSyncPositive    : "HSyncPositive",
 *     RR_HSyncNegative    : "HSyncNegative",             # <<<<<<<<<<<<<<
 *     RR_VSyncPositive    : "VSyncPositive",
 *     RR_VSyncNegative    : "VSyncNegative",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_HSyncNegative); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_HSyncNegative) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":86
 *     RR_HSyncPositive    : "HSyncPositive",
 *     RR_HSyncNegative    : "HSyncNegative",
 *     RR_VSyncPositive    : "VSyncPositive",             # <<<<<<<<<<<<<<
 *     RR_VSyncNegative    : "VSyncNegative",
 *     RR_Interlace        : "Interlace",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_VSyncPositive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_VSyncPositive) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":87
 *     RR_HSyncNegative    : "HSyncNegative",
 *     RR_VSyncPositive    : "VSyncPositive",
 *     RR_VSyncNegative    : "VSyncNegative",             # <<<<<<<<<<<<<<
 *     RR_Interlace        : "Interlace",
 *     RR_DoubleScan       : "DoubleScan",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_VSyncNegative); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_VSyncNegative) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":88
 *     RR_VSyncPositive    : "VSyncPositive",
 *     RR_VSyncNegative    : "VSyncNegative",
 *     RR_Interlace        : "Interlace",             # <<<<<<<<<<<<<<
 *     RR_DoubleScan       : "DoubleScan",
 *     RR_CSync            : "CSync",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_Interlace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_Interlace) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":89
 *     RR_VSyncNegative    : "VSyncNegative",
 *     RR_Interlace        : "Interlace",
 *     RR_DoubleScan       : "DoubleScan",             # <<<<<<<<<<<<<<
 *     RR_CSync            : "CSync",
 *     RR_CSyncPositive    : "CSyncPositive",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_DoubleScan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_DoubleScan) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":90
 *     RR_Interlace        : "Interlace",
 *     RR_DoubleScan       : "DoubleScan",
 *     RR_CSync            : "CSync",             # <<<<<<<<<<<<<<
 *     RR_CSyncPositive    : "CSyncPositive",
 *     RR_CSyncNegative    : "CSyncNegative",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_CSync); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_CSync) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":91
 *     RR_DoubleScan       : "DoubleScan",
 *     RR_CSync            : "CSync",
 *     RR_CSyncPositive    : "CSyncPositive",             # <<<<<<<<<<<<<<
 *     RR_CSyncNegative    : "CSyncNegative",
 *     RR_HSkewPresent     : "HSkewPresent",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_CSyncPositive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_CSyncPositive) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":92
 *     RR_CSync            : "CSync",
 *     RR_CSyncPositive    : "CSyncPositive",
 *     RR_CSyncNegative    : "CSyncNegative",             # <<<<<<<<<<<<<<
 *     RR_HSkewPresent     : "HSkewPresent",
 *     RR_BCast            : "BCast",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_CSyncNegative); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_CSyncNegative) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":93
 *     RR_CSyncPositive    : "CSyncPositive",
 *     RR_CSyncNegative    : "CSyncNegative",
 *     RR_HSkewPresent     : "HSkewPresent",             # <<<<<<<<<<<<<<
 *     RR_BCast            : "BCast",
 *     RR_PixelMultiplex   : "PixelMultiplex",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_HSkewPresent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_HSkewPresent) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":94
 *     RR_CSyncNegative    : "CSyncNegative",
 *     RR_HSkewPresent     : "HSkewPresent",
 *     RR_BCast            : "BCast",             # <<<<<<<<<<<<<<
 *     RR_PixelMultiplex   : "PixelMultiplex",
 *     RR_DoubleClock      : "DoubleClock",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_BCast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_BCast) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":95
 *     RR_HSkewPresent     : "HSkewPresent",
 *     RR_BCast            : "BCast",
 *     RR_PixelMultiplex   : "PixelMultiplex",             # <<<<<<<<<<<<<<
 *     RR_DoubleClock      : "DoubleClock",
 *     RR_ClockDivideBy2   : "ClockDivideBy2",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_PixelMultiplex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_PixelMultiplex) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":96
 *     RR_BCast            : "BCast",
 *     RR_PixelMultiplex   : "PixelMultiplex",
 *     RR_DoubleClock      : "DoubleClock",             # <<<<<<<<<<<<<<
 *     RR_ClockDivideBy2   : "ClockDivideBy2",
 * }
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_DoubleClock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_DoubleClock) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":97
 *     RR_PixelMultiplex   : "PixelMultiplex",
 *     RR_DoubleClock      : "DoubleClock",
 *     RR_ClockDivideBy2   : "ClockDivideBy2",             # <<<<<<<<<<<<<<
 * }
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(RR_ClockDivideBy2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_ClockDivideBy2) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MODE_FLAGS_STR, __pyx_t_4) < (0)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":101
 * 
 * ROTATIONS: Dict[int, int] = {
 *     RR_Rotate_0             : 0,             # <<<<<<<<<<<<<<
 *     RR_Rotate_90            : 90,
 *     RR_Rotate_180           : 180,
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_int_0) < (0)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":102
 * ROTATIONS: Dict[int, int] = {
 *     RR_Rotate_0             : 0,
 *     RR_Rotate_90            : 90,             # <<<<<<<<<<<<<<
 *     RR_Rotate_180           : 180,
 *     RR_Rotate_270           : 270,
*/
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_90); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_int_90) < (0)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":103
 *     RR_Rotate_0             : 0,
 *     RR_Rotate_90            : 90,
 *     RR_Rotate_180           : 180,             # <<<<<<<<<<<<<<
 *     RR_Rotate_270           : 270,
 * }
*/
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_180); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_int_180) < (0)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":104
 *     RR_Rotate_90            : 90,
 *     RR_Rotate_180           : 180,
 *     RR_Rotate_270           : 270,             # <<<<<<<<<<<<<<
 * }
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_270); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_int_270) < (0)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ROTATIONS, __pyx_t_4) < (0)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":108
 * 
 * ROTATION_CONST: Dict[int, int] = {
 *     0: RR_Rotate_0,             # <<<<<<<<<<<<<<
 *     90: RR_Rotate_90,
 *     180: RR_Rotate_180,
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":109
 * ROTATION_CONST: Dict[int, int] = {
 *     0: RR_Rotate_0,
 *     90: RR_Rotate_90,             # <<<<<<<<<<<<<<
 *     180: RR_Rotate_180,
 *     270: RR_Rotate_270,
*/
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_90); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_int_90, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":110
 *     0: RR_Rotate_0,
 *     90: RR_Rotate_90,
 *     180: RR_Rotate_180,             # <<<<<<<<<<<<<<
 *     270: RR_Rotate_270,
 * }
*/
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_180); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_int_180, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":111
 *     90: RR_Rotate_90,
 *     180: RR_Rotate_180,
 *     270: RR_Rotate_270,             # <<<<<<<<<<<<<<
 * }
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_From_Rotation(RR_Rotate_270); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_int_270, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ROTATION_CONST, __pyx_t_4) < (0)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":115
 * 
 * CONNECTION_STR: Dict[int, str] = {
 *     RR_Connected            : "Connected",             # <<<<<<<<<<<<<<
 *     RR_Disconnected         : "Disconnected",
 *     RR_UnknownConnection    : "Unknown",
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyLong_From_Connection(RR_Connected); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_Connected) < (0)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":116
 * CONNECTION_STR: Dict[int, str] = {
 *     RR_Connected            : "Connected",
 *     RR_Disconnected         : "Disconnected",             # <<<<<<<<<<<<<<
 *     RR_UnknownConnection    : "Unknown",
 * }
*/
  __pyx_t_2 = __Pyx_PyLong_From_Connection(RR_Disconnected); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_Disconnected) < (0)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":117
 *     RR_Connected            : "Connected",
 *     RR_Disconnected         : "Disconnected",
 *     RR_UnknownConnection    : "Unknown",             # <<<<<<<<<<<<<<
 * }
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_From_Connection(RR_UnknownConnection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_Unknown) < (0)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_CONNECTION_STR, __pyx_t_4) < (0)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":121
 * 
 * 
 * def get_rotation(Rotation v) -> int:             # <<<<<<<<<<<<<<
 *     return ROTATIONS.get(v, 0)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 121, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_1get_rotation, 0, __pyx_mstate_global->__pyx_n_u_get_rotation, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_rotation, __pyx_t_2) < (0)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":125
 * 
 * 
 * def get_rotations(Rotation v) -> List[int]:             # <<<<<<<<<<<<<<
 *     rotations = []
 *     for renum, rval in ROTATIONS.items():
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_List_int) < (0)) __PYX_ERR(0, 125, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_3get_rotations, 0, __pyx_mstate_global->__pyx_n_u_get_rotations, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_rotations, __pyx_t_4) < (0)) __PYX_ERR(0, 125, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":142
 * 
 * SUBPIXEL_STR = {
 *     SubPixelUnknown : "unknown",             # <<<<<<<<<<<<<<
 *     SubPixelHorizontalRGB : "RGB",
 *     SubPixelHorizontalBGR : "BGR",
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyLong_From_int(SubPixelUnknown); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_unknown) < (0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":143
 * SUBPIXEL_STR = {
 *     SubPixelUnknown : "unknown",
 *     SubPixelHorizontalRGB : "RGB",             # <<<<<<<<<<<<<<
 *     SubPixelHorizontalBGR : "BGR",
 *     SubPixelVerticalRGB : "VRGB",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(SubPixelHorizontalRGB); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_RGB) < (0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":144
 *     SubPixelUnknown : "unknown",
 *     SubPixelHorizontalRGB : "RGB",
 *     SubPixelHorizontalBGR : "BGR",             # <<<<<<<<<<<<<<
 *     SubPixelVerticalRGB : "VRGB",
 *     SubPixelVerticalBGR : "VBGR",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(SubPixelHorizontalBGR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_BGR) < (0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":145
 *     SubPixelHorizontalRGB : "RGB",
 *     SubPixelHorizontalBGR : "BGR",
 *     SubPixelVerticalRGB : "VRGB",             # <<<<<<<<<<<<<<
 *     SubPixelVerticalBGR : "VBGR",
 *     SubPixelNone        : "none",
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(SubPixelVerticalRGB); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_VRGB) < (0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":146
 *     SubPixelHorizontalBGR : "BGR",
 *     SubPixelVerticalRGB : "VRGB",
 *     SubPixelVerticalBGR : "VBGR",             # <<<<<<<<<<<<<<
 *     SubPixelNone        : "none",
 * }
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(SubPixelVerticalBGR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_VBGR) < (0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":147
 *     SubPixelVerticalRGB : "VRGB",
 *     SubPixelVerticalBGR : "VBGR",
 *     SubPixelNone        : "none",             # <<<<<<<<<<<<<<
 * }
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(SubPixelNone); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_none) < (0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SUBPIXEL_STR, __pyx_t_4) < (0)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":578
 * 
 * 
 * def get_monitor_properties(display: int) -> dict:             # <<<<<<<<<<<<<<
 *     log("get_monitor_properties(%#x)", display)
 *     cdef Display *d = <Display *> (<uintptr_t> display)
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_display, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 578, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_dict) < (0)) __PYX_ERR(0, 578, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_5get_monitor_properties, 0, __pyx_mstate_global->__pyx_n_u_get_monitor_properties, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_monitor_properties, __pyx_t_2) < (0)) __PYX_ERR(0, 578, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":618
 *         return f"RandRBindings({self.display_name})"
 * 
 *     def get_version(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         return self.version
 * 
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Tuple_int_int) < (0)) __PYX_ERR(0, 618, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_5get_version, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_versio, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_version, __pyx_t_4) < (0)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":621
 *         return self.version
 * 
 *     def check_randr_sizes(self) -> bool:             # <<<<<<<<<<<<<<
 *         #check for wayland, which has no sizes:
 *         #(and we wouldn't be able to set screen resolutions)
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 621, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_7check_randr_sizes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_check_rand, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_check_randr_sizes, __pyx_t_2) < (0)) __PYX_ERR(0, 621, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":634
 *         return num_sizes > 0
 * 
 *     def has_randr(self) -> bool:             # <<<<<<<<<<<<<<
 *         return bool(self._has_randr)
 * 
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 634, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_9has_randr, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_has_randr, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_has_randr, __pyx_t_4) < (0)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":637
 *         return bool(self._has_randr)
 * 
 *     def select_screen_changes(self) -> None:             # <<<<<<<<<<<<<<
 *         cdef int mask = RRScreenChangeNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 637, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_11select_screen_changes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_select_scr, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_select_screen_changes, __pyx_t_2) < (0)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":642
 *         XRRSelectInput(self.display, root, mask)
 * 
 *     def select_crtc_output_changes(self) -> None:             # <<<<<<<<<<<<<<
 *         cdef int mask = RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask
 *         cdef Window root = XDefaultRootWindow(self.display)
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 642, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_13select_crtc_output_changes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_select_crt, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_select_crtc_output_changes, __pyx_t_4) < (0)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":659
 *         return sizes
 * 
 *     def get_xrr_screen_sizes(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         v = self._get_xrr_screen_sizes()
 *         log(f"get_xrr_screen_sizes()={v}")
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_List_Tuple_int_int) < (0)) __PYX_ERR(0, 659, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_15get_xrr_screen_sizes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_xrr_sc, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_xrr_screen_sizes_2, __pyx_t_2) < (0)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":734
 *             XRRFreeScreenConfigInfo(config)
 * 
 *     def get_screen_count(self) -> int:             # <<<<<<<<<<<<<<
 *         return XScreenCount(self.display)
 * 
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 734, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_17get_screen_count, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_screen, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_screen_count, __pyx_t_4) < (0)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":737
 *         return XScreenCount(self.display)
 * 
 *     def get_screen_size_mm(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         sizes = self.get_screen_sizes_mm()
 *         tw, th = 0, 0
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Tuple_int_int) < (0)) __PYX_ERR(0, 737, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_19get_screen_size_mm, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_screen_2, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_screen_size_mm, __pyx_t_2) < (0)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":746
 *         return tw, th
 * 
 *     def get_screen_sizes_mm(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_List_Tuple_int_int) < (0)) __PYX_ERR(0, 746, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_21get_screen_sizes_mm, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_screen_3, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_screen_sizes_mm, __pyx_t_4) < (0)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":756
 *         return sizes
 * 
 *     def get_screen_sizes(self) -> List[Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef unsigned int n = XScreenCount(self.display)
 *         cdef unsigned int i, w, h
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_List_Tuple_int_int) < (0)) __PYX_ERR(0, 756, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_23get_screen_sizes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_screen_4, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_screen_sizes, __pyx_t_2) < (0)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":766
 *         return sizes
 * 
 *     def get_screen_size(self) -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRCrtcInfo *crtc_info = NULL
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Tuple_int_int) < (0)) __PYX_ERR(0, 766, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_25get_screen_size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_screen_5, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_screen_size, __pyx_t_4) < (0)) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":790
 *         return maxx, maxy
 * 
 *     def get_screen_size_range(self) -> Tuple[Tuple[int, int], Tuple[int, int]]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef int minWidth, minHeight, maxWidth, maxHeight
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Tuple_Tuple_int_int_Tuple_int_in) < (0)) __PYX_ERR(0, 790, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_27get_screen_size_range, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_screen_6, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_screen_size_range, __pyx_t_2) < (0)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":798
 *         return (minWidth, minHeight), (maxWidth, maxHeight)
 * 
 *     def get_vrefresh(self) -> int:             # <<<<<<<<<<<<<<
 *         voutputs = self.get_vrefresh_outputs()
 *         if voutputs:
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 798, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_29get_vrefresh, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_vrefre, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_vrefresh, __pyx_t_4) < (0)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":804
 *         return self.get_vrefresh_display()
 * 
 *     def get_vrefresh_display(self) -> int:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRRScreenConfiguration *config = XRRGetScreenInfo(self.display, window)
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_31get_vrefresh_display, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_vrefre_2, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_vrefresh_display, __pyx_t_2) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":815
 *             XRRFreeScreenConfigInfo(config)
 * 
 *     def get_vrefresh_outputs(self) -> Dict[int, int]:             # <<<<<<<<<<<<<<
 *         cdef Window window = XDefaultRootWindow(self.display)
 *         cdef XRROutputInfo *output_info = NULL
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Dict_int_int) < (0)) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_33get_vrefresh_outputs, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_vrefre_3, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_vrefresh_outputs, __pyx_t_4) < (0)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/x11/bindings/randr.pyx":854
 *         return rates
 * 
 *     def set_screen_size(self, int width, int height) -> bool:             # <<<<<<<<<<<<<<
 *         return self._set_screen_size(width, height)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 854, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_35set_screen_size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_set_screen, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_set_screen_size_2, __pyx_t_2) < (0)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":857
 *         return self._set_screen_size(width, height)
 * 
 *     def add_screen_size(self, unsigned int w, unsigned int h, unsigned int vrefresh=DEFAULT_REFRESH_RATE) -> RRMode:             # <<<<<<<<<<<<<<
 *         hz = vrefresh / 1000
 *         hzstr = str(hz)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEFAULT_REFRESH_RATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyLong_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_mstate_global->__pyx_k__7 = __pyx_t_6;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEFAULT_REFRESH_RATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyLong_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_RRMode) < (0)) __PYX_ERR(0, 857, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_37add_screen_size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_add_screen, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_add_screen_size, __pyx_t_7) < (0)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "xpra/x11/bindings/randr.pyx":965
 *         return mode
 * 
 *     def remove_screen_size(self, unsigned int w, unsigned int h) -> None:             # <<<<<<<<<<<<<<
 *         #TODO: instead of keeping the mode ID,
 *         #we should query the output and find the mode dynamically...
*/
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 965, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_39remove_screen_size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_remove_scr, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_remove_screen_size, __pyx_t_2) < (0)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":973
 *             del self._added_modes[name]
 * 
 *     def remove_mode(self, RRMode mode) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("remove_mode")
 *         cdef RROutput output = self.get_current_output()
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 973, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_41remove_mode, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_remove_mod, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_remove_mode, __pyx_t_7) < (0)) __PYX_ERR(0, 973, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "xpra/x11/bindings/randr.pyx":997
 *             XRRFreeScreenResources(rsc)
 * 
 *     def xrr_set_screen_size(self, int w, int h, int wmm, int hmm) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("xrr_set_screen_size")
 *         #and now use it:
*/
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 997, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_43xrr_set_screen_size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_xrr_set_sc, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_xrr_set_screen_size, __pyx_t_2) < (0)) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1010
 * ################################################################
 * 
 *     def is_dummy16(self) -> bool:             # <<<<<<<<<<<<<<
 *         self.context_check("is_dummy16")
 *         #figure out if we're dealing with the dummy with randr 1.6 support
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1010, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_45is_dummy16, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_is_dummy16, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_is_dummy16, __pyx_t_7) < (0)) __PYX_ERR(0, 1010, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "xpra/x11/bindings/randr.pyx":1048
 *         return True
 * 
 *     def get_monitor_properties(self) -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *         self.context_check("get_monitor_properties")
 *         return monitor_properties(self.display)
*/
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Dict_str_Any) < (0)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_47get_monitor_properties, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_monito, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_monitor_properties, __pyx_t_2) < (0)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1052
 *         return monitor_properties(self.display)
 * 
 *     def get_all_screen_properties(self) -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *         self.context_check("get_all_screen_properties")
 *         return get_all_screen_properties(self.display)
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Dict_str_Any) < (0)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_49get_all_screen_properties, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_get_all_sc, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_get_all_screen_properties, __pyx_t_7) < (0)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "xpra/x11/bindings/randr.pyx":1056
 *         return get_all_screen_properties(self.display)
 * 
 *     def set_output_int_property(self, int output, prop_name: str, int value) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("set_output_int_property")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
  __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_prop_name, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 1056, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_51set_output_int_property, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_set_output, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_set_output_int_property, __pyx_t_2) < (0)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1072
 *                                 32, PropModeReplace, data, 1)
 * 
 *     def has_mode(self, unsigned int w, unsigned int h) -> bool:             # <<<<<<<<<<<<<<
 *         self.context_check("has_mode")
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_53has_mode, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_has_mode, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_has_mode, __pyx_t_7) < (0)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "xpra/x11/bindings/randr.pyx":1084
 *             XRRFreeScreenResources(rsc)
 * 
 *     def DeleteMonitor(self, name: str):             # <<<<<<<<<<<<<<
 *         log(f"DeleteMonitor(%r)", name)
 *         cdef Window window = XDefaultRootWindow(self.display)
*/
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_55DeleteMonitor, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_DeleteMoni, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_DeleteMonitor, __pyx_t_2) < (0)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1091
 *         self.XSync()
 * 
 *     def set_crtc_config(self, monitor_defs: Dict) -> None:             # <<<<<<<<<<<<<<
 *         self.context_check("set_crtc_config")
 *         log(f"set_crtc_config({monitor_defs})")
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_monitor_defs, __pyx_mstate_global->__pyx_n_u_Dict) < (0)) __PYX_ERR(0, 1091, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_21RandRBindingsInstance_57set_crtc_config, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance_set_crtc_c, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_3x11_8bindings_5randr_RandRBindingsInstance, __pyx_mstate_global->__pyx_n_u_set_crtc_config, __pyx_t_7) < (0)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "xpra/x11/bindings/randr.pyx":1386
 * 
 * 
 * def init_xrandr_events() -> bool:             # <<<<<<<<<<<<<<
 *     cdef Display *display = get_display()
 *     cdef int event_base = 0
*/
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_7init_xrandr_events, 0, __pyx_mstate_global->__pyx_n_u_init_xrandr_events, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_init_xrandr_events, __pyx_t_2) < (0)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/x11/bindings/randr.pyx":1405
 * 
 * 
 * cdef RandRBindingsInstance singleton = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF((PyObject *)__pyx_v_4xpra_3x11_8bindings_5randr_singleton);
  __Pyx_DECREF_SET(__pyx_v_4xpra_3x11_8bindings_5randr_singleton, ((struct __pyx_obj_4xpra_3x11_8bindings_5randr_RandRBindingsInstance *)Py_None));
  __Pyx_GIVEREF(Py_None);

  /* "xpra/x11/bindings/randr.pyx":1408
 * 
 * 
 * def RandRBindings() -> RandRBindingsInstance:             # <<<<<<<<<<<<<<
 *     global singleton
 *     if singleton is None:
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_RandRBindingsInstance) < (0)) __PYX_ERR(0, 1408, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_3x11_8bindings_5randr_9RandRBindings, 0, __pyx_mstate_global->__pyx_n_u_RandRBindings_2, NULL, __pyx_mstate_global->__pyx_n_u_xpra_x11_bindings_randr, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_RandRBindings_2, __pyx_t_7) < (0)) __PYX_ERR(0, 1408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "xpra/x11/bindings/randr.pyx":1
 * # This file is part of Xpra.             # <<<<<<<<<<<<<<
 * # Copyright (C) 2008 Nathaniel Smith <njs@pobox.com>
 * # Copyright (C) 2010 Antoine Martin <antoine@xpra.org>
*/
  __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_7) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init xpra.x11.bindings.randr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init xpra.x11.bindings.randr");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */
/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 801, __pyx_L1_error)
  __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_round); if (!__pyx_builtin_round) __PYX_ERR(0, 837, __pyx_L1_error)
  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 1116, __pyx_L1_error)

  /* Cached unbound methods */
  __pyx_mstate->__pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_get.method_name = &__pyx_mstate->__pyx_n_u_get;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  __pyx_mstate->__pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_keys.method_name = &__pyx_mstate->__pyx_n_u_keys;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__rstrip.type = (PyObject*)(&PyUnicode_Type);
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__rstrip.method_name = &__pyx_mstate->__pyx_n_u_rstrip;
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "xpra/x11/bindings/randr.pyx":583
 *     version = query_version(d)
 *     log("version=%s", version)
 *     if version < (1, 2):             # <<<<<<<<<<<<<<
 *         log.warn("Warning: XRandR version %s does not support monitors", version)
 *         return {}
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "xpra/x11/bindings/randr.pyx":594
 *     if not r:
 *         log(f"no XRandR!")
 *         return (0, 0)             # <<<<<<<<<<<<<<
 *     cdef int major = 0, minor = 0
 *     if not XRRQueryVersion(display, &major, &minor):
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

  /* "xpra/x11/bindings/randr.pyx":613
 *         self._added_modes = {}
 *         self.version = query_version(self.display)
 *         self._has_randr = self.version > (1, 0) and self.check_randr_sizes()             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "xpra/x11/bindings/randr.pyx":1016
 *             log("is_dummy16() no randr!")
 *             return False
 *         if self.version<(1, 6):             # <<<<<<<<<<<<<<
 *             log(f"is_dummy16() randr version too old: {self.version}")
 *             return False
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_6); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 1016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);

  /* "xpra/x11/bindings/randr.pyx":1168
 *                     x, y, width, height = 0, 0, 1024, 768
 *                     if m:
 *                         if m.get("primary", False):             # <<<<<<<<<<<<<<
 *                             primary = i
 *                         x, y, width, height = m["geometry"]
*/
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_primary, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 1168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

  /* "xpra/x11/bindings/randr.pyx":1171
 *                             primary = i
 *                         x, y, width, height = m["geometry"]
 *                         vrefresh = m.get("refresh-rate", 0)             # <<<<<<<<<<<<<<
 *                         if vrefresh <= 0:
 *                             vrefresh = DEFAULT_REFRESH_RATE
*/
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_refresh_rate, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);

  /* "xpra/x11/bindings/randr.pyx":1231
 *                         noutput = 0
 * 
 *                     rotation_int = m.get("rotation", 0)             # <<<<<<<<<<<<<<
 *                     rotation = ROTATION_CONST.get(rotation_int, RR_Rotate_0)
 * 
*/
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_rotation, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);

  /* "xpra/x11/bindings/randr.pyx":1242
 *                     if r:
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")
 *                     mmw = m.get("width-mm", 0) or dpi96(width)             # <<<<<<<<<<<<<<
 *                     mmh = m.get("height-mm", 0) or dpi96(height)
 *                     self.set_output_int_property(i, "WIDTH_MM", mmw)
*/
  __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_width_mm, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);

  /* "xpra/x11/bindings/randr.pyx":1243
 *                         raise RuntimeError(f"failed to set crtc config for monitor {i}")
 *                     mmw = m.get("width-mm", 0) or dpi96(width)
 *                     mmh = m.get("height-mm", 0) or dpi96(height)             # <<<<<<<<<<<<<<
 *                     self.set_output_int_property(i, "WIDTH_MM", mmw)
 *                     self.set_output_int_property(i, "HEIGHT_MM", mmh)
*/
  __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_height_mm, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "xpra/x11/bindings/randr.pyx":1308
 *                 for i, m  in monitor_defs.items():
 *                     basename = "VFB" if mi == 0 else f"VFB{mi}"
 *                     name = prettify_plug_name(m.get("name", ""))             # <<<<<<<<<<<<<<
 *                     if not name or name in all_names:
 *                         name = basename
*/
  __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_kp_u_); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);

  /* "xpra/x11/bindings/randr.pyx":30
 * from xpra.log import Logger
 * 
 * log = Logger("x11", "bindings", "randr")             # <<<<<<<<<<<<<<
 * 
 * import_check("randr")
*/
  __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_n_u_x11, __pyx_mstate_global->__pyx_n_u_bindings, __pyx_mstate_global->__pyx_n_u_randr); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "xpra/x11/bindings/randr.pyx":34
 * import_check("randr")
 * 
 * TIMESTAMPS = envbool("XPRA_RANDR_TIMESTAMPS", False)             # <<<<<<<<<<<<<<
 * GAMMA = envbool("XPRA_RANDR_GAMMA", False)
 * MAX_NEW_MODES = envint("XPRA_RANDR_MAX_NEW_MODES", 32)
*/
  __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_XPRA_RANDR_TIMESTAMPS, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);

  /* "xpra/x11/bindings/randr.pyx":35
 * 
 * TIMESTAMPS = envbool("XPRA_RANDR_TIMESTAMPS", False)
 * GAMMA = envbool("XPRA_RANDR_GAMMA", False)             # <<<<<<<<<<<<<<
 * MAX_NEW_MODES = envint("XPRA_RANDR_MAX_NEW_MODES", 32)
 * assert MAX_NEW_MODES>=2
*/
  __pyx_mstate_global->__pyx_tuple[12] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_XPRA_RANDR_GAMMA, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[12])) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[12]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[12]);

  /* "xpra/x11/bindings/randr.pyx":36
 * TIMESTAMPS = envbool("XPRA_RANDR_TIMESTAMPS", False)
 * GAMMA = envbool("XPRA_RANDR_GAMMA", False)
 * MAX_NEW_MODES = envint("XPRA_RANDR_MAX_NEW_MODES", 32)             # <<<<<<<<<<<<<<
 * assert MAX_NEW_MODES>=2
 * 
*/
  __pyx_mstate_global->__pyx_tuple[13] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_XPRA_RANDR_MAX_NEW_MODES, __pyx_mstate_global->__pyx_int_32); if (unlikely(!__pyx_mstate_global->__pyx_tuple[13])) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[13]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[13]);
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_tuple;
    for (Py_ssize_t i=0; i<14; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  {
    const struct { const unsigned int length: 12; } index[] = {{0},{1},{17},{14},{14},{37},{47},{12},{41},{39},{38},{39},{46},{36},{36},{12},{14},{26},{34},{16},{4},{26},{2},{21},{9},{44},{4},{14},{21},{39},{15},{42},{57},{36},{52},{25},{40},{28},{52},{26},{29},{23},{59},{62},{36},{30},{42},{2},{1},{3},{3},{1},{1},{1},{1},{2},{15},{31},{14},{18},{12},{12},{12},{21},{9},{30},{19},{30},{19},{33},{50},{7},{16},{7},{16},{6},{11},{15},{9},{15},{7},{32},{9},{4},{6},{27},{38},{6},{12},{6},{31},{6},{2},{69},{27},{23},{6},{10},{12},{7},{5},{9},{2},{15},{15},{22},{4},{21},{22},{25},{22},{18},{36},{9},{14},{23},{5},{5},{10},{8},{9},{12},{10},{16},{14},{14},{34},{11},{12},{10},{7},{5},{9},{8},{21},{13},{14},{14},{24},{8},{12},{17},{12},{18},{18},{3},{13},{38},{16},{15},{30},{20},{13},{24},{9},{14},{4},{4},{12},{58},{22},{33},{45},{14},{13},{18},{10},{12},{7},{10},{8},{17},{23},{2},{27},{26},{4},{5},{3},{8},{14},{5},{13},{13},{14},{9},{20},{13},{4},{12},{11},{10},{4},{5},{9},{12},{13},{13},{2},{7},{9},{4},{6},{13},{14},{4},{14},{20},{3},{9},{14},{6},{21},{35},{55},{37},{39},{47},{44},{38},{40},{41},{38},{37},{43},{33},{34},{42},{42},{42},{30},{31},{32},{33},{40},{48},{43},{37},{45},{37},{41},{13},{12},{9},{18},{10},{5},{7},{4},{3},{4},{13},{13},{8},{16},{24},{21},{5},{12},{15},{15},{9},{6},{7},{18},{4},{9},{8},{8},{4},{4},{8},{17},{18},{6},{5},{6},{16},{10},{13},{5},{4},{9},{5},{3},{1},{4},{10},{6},{4},{7},{5},{3},{7},{4},{4},{6},{7},{6},{5},{10},{10},{8},{3},{9},{10},{8},{5},{7},{8},{3},{25},{13},{30},{18},{30},{22},{32},{38},{12},{13},{16},{15},{18},{21},{16},{19},{11},{12},{20},{20},{20},{5},{1},{8},{9},{6},{3},{2},{5},{1},{2},{5},{4},{18},{3},{13},{10},{5},{1},{1},{4},{6},{3},{1},{8},{4},{10},{3},{9},{8},{4},{4},{7},{2},{3},{9},{8},{3},{3},{4},{9},{9},{5},{10},{7},{12},{13},{36},{8},{9},{6},{1},{4},{8},{9},{9},{4},{9},{4},{7},{9},{9},{1},{6},{11},{12},{7},{4},{10},{7},{18},{7},{4},{9},{10},{5},{6},{12},{14},{12},{1},{5},{4},{5},{3},{11},{18},{5},{6},{4},{6},{6},{8},{12},{9},{5},{3},{3},{6},{4},{8},{8},{26},{21},{4},{4},{3},{15},{30},{12},{23},{15},{10},{10},{5},{6},{3},{6},{14},{8},{2},{5},{4},{9},{2},{6},{7},{6},{1},{5},{6},{7},{8},{8},{1},{4},{5},{6},{3},{1},{3},{11},{8},{13},{16},{16},{23},{19},{1},{27},{47},{1115},{2},{16},{26},{90},{58},{16},{19},{19},{18},{2},{52},{60},{133},{300},{59},{81},{82},{2761},{26},{107},{72},{178},{2},{2},{75},{12},{151},{2},{2},{43},{32},{348},{74},{74},{2},{2},{195},{35},{84},{30},{46},{3},{30},{143},{1},{1},{1}};
    #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (6023 bytes) */
const char* const cstring = "(\265/\375`o4\355\273\000z\300\364(H\340\316l\0030\314#\014\343\343\032O\344\371\230\035\263cv\\\013\263c6C\360\301\312E\"3\"\024\331\342\275uJ\222\322\301\242\344\370$\314\256s\360\332C^\320[\202\021\230\353\265\311\010!;a\027\223x\241\336x\177\rP\002s\002\224\00265\262\030\354E\003bF&\346\203\007\230\027\227\016\256\026\253\005\334\361n$\024f\024(h\364\266\333\201\250\302\325j\307\222m}\324a[\027G].\3072\302\307\335\346)\312Cw\212KG\254\315\215;\267u<\222\342\231\251\225-\242\247\212\334\273\3616Ky\332\367\3556\346\210\273\253P9\343\025]?OT\3349t\253T<T\227#zS\211\37362\202\272\235=Ge\236\346\236a\221Ly\037S\256R\235f\35149\257i\222\246\302\267\275s\304\225\322i\246\254\362\254L\315\361T\226\252n\253\215\333F\352~v\225\255\243\242\271U\241\311\323\355\034\256\262\261\244P(\272C\361=\346\021\234B\345nn\024M\303\034\326x\n\335\"y\226\346f\031o\242\252\237\"\257,S\021\025w\r\325$>\371\255\324}\354\252\223\014q\316\266\260\353rsT\337R42\rO]\363P\2151&I\215S\233\347\274Km\346\235\033{\250Q\230\003N\221`\n\030\257\340\rx%\025\343'0U\226\030\205yy\356\032K*5\342\221\035\310\t\305b\365\035\333(\013\006\303a\311`\254Q\334#m\014\367\215\223:\034\373\212\356Z\304-\230\226\213\327\321};\321\233\250;z\336n)\337\247\230\023n[\210\356\234x\302+\233\353\031\356\246\270M4\335\344L\347\314s\344\346\356\273\215q\360\212\211\352\033<\"\236Xx\264\261\2373\273fj\033+\206\342-0\3306\317\031\314O\034\306\323n\233#)Sb\223\267T6\"&\206\003\336).\323r\334\351\362\234i\024\326y\3015s\314\t\365\315L\261\211\271\266a\236&o|\0241\037m\035\025\315\364\244a\314#\315\363\204\371\336mQ\034I\235\323m\223\227\230v\342\316G\022o[\307;\267G\264\353\214\234\327F\232y\206\030\025M=\236pOo==\321\023\336\342YbQ\324\370\354X\334\344\250i8\354\350I+O\224\206w\327(\266\321\372\256\241\351\3117\212\315\275\321\220c\316w\030j\334O\323\324!^AO\024u\225\340\231 \036A;/\201G\2729\216\350\341\330J\241'\024z\366\321<ev\337\344nU\010\232\035\361\342\n\301#\343\257\013V\235\227\n\252/;+\217\307\255;U\253\rV\017u#\303""\347Qq;\n2|+u\201\232\262s\000\344{\365V\336\356jW\003\311'\001\371\300\366\323\342X\n\036\037B\001\214\001/V\036\344\363_\254\210\365\260(\005\177\265\226\326\231\235\014\220o\305N\370|\217o\255\253U\305\216\002\220\257\344?>\177\345\367\346\243\206\361-\253\241\340)\343:\336\376`\216\247\207\321\254\201\311\233\247z\3261R=\324\273-C1;\363FO\2636b\021]\016\317%#j\250\306\\\324\345`\244\360I\214Uc\353\2654\363\215b\021\214\024\271s$\356<\227#\307#(f x4\030)q<s(\221\026\217\204\204\226I\310rW\226:\335\2513Q\255\323\345x.\325u\335\211v\276{\316\271\207i\306m.\232\233\323t6R\347\320\033\312u\266\214\212\033\345(\251S\\.\347\361\246\303[\316\274\333\276\361\372\255\226\222\267\334\305|nr6r~\336L\3234{6\313\260\237\234\266\305\274\3114s]i\216\345h+y7/;]\346ps\324e\316e\355$W\234\267srP\360r\3671\363\221\217\346(\216\243\216M\307V\2266[\215\353~\242\272,u-\347\320Li9w\216\2164\216\352\335\036s\34667o\227r\001\355\242(\346x\310s\317\233\347\204z\206\366L\206\344y\316vJ\316R]\236\335\034\3213$9G-r\235E\023'\303Z3 \214\006\347E\326\202\271\261\261\261i\351`cc\346\23051\032\031P\026s\311\300\310Z\256\326\214\213&V\023\213q\341\300\320\264\324\304F\236C\236yY\346nns\327H4pRg \311$\241i\302\300r\014\224\201\200\265\270\300h\033\326w{&\357x49\357\306N\246241\0270\246C\216\271Z d\362\215k&\343\2002\350\256\325\316\230\035j\022\335\335\204\201\271\\\\\262\031\030\235\227n\322\304^dd\262\354\305\005\306\365\002\312\310\200.1r\226\236!\037[.\031\010\313/1\027\254\203\013\226e15`\270\315\022^\313\026\307\334\330\032\371I\243k{&\306\202\311by\006\004\214\214\345\232\231\001\301\212\001g`Z0\220\005si\351\\\263Zd@\310@\021!pn\002&\0167\2455A\371\264\333b\023\252`\242\265\030\330\t\246\337k\201[`\325Sy\035\270h\310k\300\235\351w\300;\242-i\003\264\263\234\0171\371J\330\247Y\223\032L\372\225\332\024\014\274k%\215~+V\305\032a\244\322sy\037\270\0367\002+\363\247\326\304\343\362t\3364\272iE\034\254\313\233H%\354\026\200G\037l\007\251\205\304\362\027B\356\205\324\367\260-\337\206\3605\355%""\220\036x\335\016hc,\010\333\341C\326\2165\002\t\211\324\241O\374\023/\177v\340\203\005\300\202\336\017\356\307\004\017\213\363\004<\026\371:F>OO\202\206\220OY\037\214\272~\031\274:\355\311\307\377\020\371B\032>\006o\313]\271&X\2205s'\332e\340\352\260'l\211\235YI.\350^hKmI\351{<\257\345e\335X;P!\t+\377\370\030U\244\341\323\253I\001\221:*\200\001zQ*\261\"\240\237\366!?\234Vm\253\025\324\217\231\264\335\033yCo\350jh\360W\275R\217\277\247\227l_\004\330\230/\361\001<\212\326\352K\315y\324\331\216I\200\022\033bG\036_\264\026\350\255z\373\305\340\2222\376\n\353\000k|p\275 \002\367\352XC@\177\263\222|l\235\240n\340V\275Bha\364z\340\037\350\301\354\264\232`\247\314\340K\265A\310\2137a\224\334\232\026\244\345\263?\313?\223\370$d_\244'\276#\356\312\353u\371\220\227ye|pm\203\326\323\266\330\025\353\311\372\000d\345\032\340\333\372d\374\\\\K`\364E\013\274\307\203\326\221h\346mk\213J\215*@\325\250\221}Y\354\333\364p\336\225\004,\312\377\324\322\n\000\205S946X\r_H\202\312\013\200|1\3307\320k\275\253\227\265r{\253\361Quw\362\373\205|\t\364q\n\276\336I\360\361\205\300\3718,\237%\344\207l|\026\306N\370\351\336L\350\203\250)p!\325\243\242\264\253V\205\327>\304z\340w\027\004J\253\203\217\017\347?\254\244\217\017\\I\030\277\244.\310HwX\272M\001\325\r\325%\372\037U\303\233X\033\277\262\366R+\262/V\365\340?\000\371l\265_\333\177\307\374\217\236\007\223\277\240]\215>\310\216\200\353\306za\347\300\007c|\220\275\361\2407m|\217\253\362\371\240\377\3605k\211gE\331\361\254-u\245\366\235\007\237_R;\354\274\210U\264z\326\021\310\207c\0031/-h\316\242\2501R\262\031\227\215\013'\273b0\220&\247d\225\274Z\355L\362I\356X\334fm\344f\212\221\302\374\304\341u\243\375\200\335\016\201\035\320\347\203\221\022}\221\216\200\017\206\216W\255\006,\224\344's~\216\3765_d\364\373,h\303\234Vu#\270\027\273\342\273\270fl|\320\203d\353\275z2\031\376\312\r`\301\3641*\205\207\023T\212\321\366__\347=i)\371%&\006\370w\342\302\033\340E\321\206Ha@m\007\213\016\320\336\244\346\202\276\340\351\341\336\006o\030\362\241\200""\002\036\234n}\276\366:\023\216\017b[\025\031\215E\365y\t:\276l\265\223\341\351PZE\020\224cu\251\242\222u\013\360\25435\304\016\002\220\317,\177\371\361\000\260r\250!\255@\253\014\300\237?\371\027\213b\372&\234\322n\326\264:\020\255\035\240\335\312ZI\275\230\211\342\361\301U\004\366\241\206\324\024\032\226\317\362\371!V\307C\t\344\227^\000h\013\363\271\025FSM>\037C\351\313p\355N\224\001\264\"Pk+\357\302m,p\0352F\034\032\277\020\no*\321|\216\236\247\007\362\270\240\226\300[sm\255\316\005w\370J\300>\371\332\334\221\326\000\333Zq \017\224\037\302r\233\316\225yo\334\014,\357\314\325\265\037:\006\025\230\025[\302\365t\257\205)\344f\365\010y\224\205\363c\311\r\271a\333\322bE<_O(\340\252\355\254^\325\002\260\274\006,\t\226\312@\303\207 \364\022p\036\346\021\254\243\214\037\207/\021XQL\254\310\017\367\262^\225\326\001\033\2405Ai\320\330\241\320\232\262zKo\007\367\245\025aE\026\352\010\201:\000\034\245~(z\036\266\373rk8\033\276\004\332\374^\264-:\371\017\222~m\266\205\275\001\333\217\266\306&\215\221%\340\212]\300\246\314\322PO\366\212~\241W&\246\335\010\241\304X\004\247\226g\370\330\204_b\311\025\002\216\003\020\226\373\020\007>\320M[\021\242\027\025\256\2106\307\262R\036\330\017\213\"\371<\353\317\363\222\310X\026\257\226\304\212~\243\337\310\207s\363ol\276\r\354\303^\377\205\341\257^\025\327A+\033y\301\367\305\305\005uU+\324/\205\362\345\240\370(J~\250Ma'\240:\354[\350\035xq\356\006\n\377\344\304\203`\237\207\347Cp\027\303\037\216\370#D|\0214\277e\"\003\352\343ZX\013\2664\334\210\344;\005\206C\250\3037\203&f\2252%#\n\222\024$\351c00p\240\270d4\241\026\232=\223\324ZM\014D\0141\242\010!\210\210\214\004R\"\"A$I\n\222\341\001\375\t\205r\215\232\312\262P\225G\n9)\3352\351E\307X\0356\255t\365\024r\333\230\202\207\310\372\340>J\202\216\244\311{|\305\364\262\274,#\260\364$\177\026\327/\360\346.M\374-o\305\205\232\326\001\325o\256\214\016\272\177\303s\363~g\002\366\204\273;\234'\003\177!\036\257\314$~\3105\337\244t\337LV\314DJ\013\014\021e\342\337q\225y\252Y\303\245)\225\275\177-v""u\037\353Z}2\272\nx\310|\367\267zsR\241\223\254s\000\246\2246\032\266:VNhR\002\264\276\362\313\030\2449*k\345S\3069x<\207\222R\216\017K\210\277\270TvFa\336\262\354\230\022\236\324\337\342\020\n\313\"Q\205\243\361\025\301\3104c\201<\265i\365[\244j\334\035\\\342\230.~r\361\300\032\322%|$\035x\206\n\017g\031\376\225D\304B\"\347Z\207<\263\202\241IH=\370qaM\002l\005,\226\31702\017\003\235\366?{P\203\343\356\342K\031<@\2460i\277\257{\014\237\024\236l\234~4\370PFc*0Q\332\032A4\330\t{b\304:\205|\360&\014%\252\201\245\367f\232R\274p\256(`Q7\311t']\366\002\220\214\033n\236T\335\214\261\372\t\312\2750\333\022\216\360\245\177f\021`,\230\003\327\"!Hn\230\250\220\244;\202i\321i\373\362>\2315\317\267\231x\235kX[g\370f\377\277\021\005\031\237l)\035>z\327;\224M\035\253\241\303\002Z\007\237\201\n0\255\266N\300\323\266\230\262\304%\323\230\224\322*\371\360\277\235\2611\3235rH\303E?\351%\326}\361kI1\235\220\210{a\353u\334\224\\\267\353a\030b\0365\324~f\200\202\253\206\312i}\325\221\263u\343<\242d<V$\0249#\263A\007Kb\207\r\006I\300\222\210vI\377\336\213\231\233\253\362\337\326\260m\336Dp\203\334\224\354;\215_\257B\342\216\350\026\376\240lLG\367\263\222\226l\344\\20\034P\330\235\350O\005\215\273\235N\311U%%\363)\002\320\203Z\304xH\020\007\003^\205R\203\377\345v\220\021\006X@\226\265H\372F&\205\361\3065\034\242\2507\331\2016m\234\010\367\305\211!\342\007\372\312\342&\333BFA\331\333i\245\227^\234P\322H\324y\304\261\252g5\267\023\333~\366\276t\366\234G\242Y\271\256k\032/\251\023!\001rm-L\234\306T\235\327\205\r\010\327\000\352\033\037\323\036\013\030\345\177-qJN\350M4\206\370\205\263\222\n^\0220\260\343B\036\275q2\333\242\035bD\222\231\364\177;%ME\371\306\001SI}`\250\242\032\274\313\202\236\245\204^\334\374\344\346\"\311\233\360j\023\375\3273[\322!\3415\r\356}\274\\\346\344\315\352\034=\207\245W\323\024.\312\231\027\243\241=\037J\\\325\214`\303\205q \262\262^\214P\365l\206 ~\265o\324\344\037\242'[\020+\336\336H\242\235X\222,\006\311\350U\001$\331\225\303[\375\367O07X\232:\344X\205\010'\246""\212\337\024c\240W\374Pn\324\225\320\314\036\204!\310\225\234\326\022\266\2433\345\265\\\003u\233\235\270\350\345l\025\227\320\231\261u\257.\2331\200u\352V\327=\305\234\261\350\207\255\032\"\250\224\320pp\355\371,\013\2203\330kK\254\000\032\360\221\220kBZH\312#>\241\245@\021\254\350^\000\355u(\225u\367I\276\024?\304\261\360\313\317#\224<\233&\275l\177\376\376\346\002T(U\327\223W\323\037&\207T\277\034\310\350g1\031t\036\350}\311|\2771\342\274O\202\242\203w\376\231\263's\264(\333\320S\316\251\017<$\201\251\014b\217\357'\210J\2316q\304\311\307sB\373U\020\211\203\336<\372\323'\036\021\242\201\3156\354\216\246\006!\215[)\007$N\236\255.`\242T\207\201\314\032+3;\211'B\373\017)[\006u\033/\025<r7\376\367\221\377\243\203\374\221g\2735\004\3531\271\244\000q!\274\326K4\243\266#\254\341\2612\302\212K\021\267=\014\201\010\353 \017\000\023=Y\350}^\027\0215\233%A-~\242\000\234\277\316\217\025\343\2045\233\350\231W\222\"\036\t$?\242\373>^H\320\226I\361\033\245\312\001\210\037\343\371\276O\257N\036\035w|\240\003\223p\000@\203\374'\354\216\245t\272G\355\377\335O\230 \245\3674\371;\217r\355\327\023\017\237\022_\3321\237m\2757\356\026d\005\220@\307OM\377\364I!\200\2558XwB\360&\322\3013\322n\204\007d\325Os\216\236\274\257\342!\233r\006^\010Q\334i\366\024\004\300\333/+E >\315\345\215\367\030`h\364\271m\023\035r/R\244$\302\2476\362\303\315\267\tN\216\310\024B/\250#/v-\215(\321\264\364\245\245{\354\377\316\302\344\320\"(\360\002\361G;\te;\033$\246\200\220\346!o\303\335\303\177\347\"\003\321yT2A\237\367\364\2121{^\213\306\326@\210\032\030\251\032X\3145j\022V\310L\312\364\331,#\210\t\254\351\311\022\243 \353\262\217Glnl\243\321\021I\255`\247\240\324\353\314\246\326\214\016\\\ry\201\005;3a\213\366\216\355[T\274\277\205\2054m\377\225\017b'\332,A\3257\014\260\304\r\215\3349\206\250\362\212\212\016G\177\010\252S\370\t\361\021w-\340\r\332XaEe\245i$\215\337\375z5HGa\246gq\004*/\321P\262\306\302\213o\201e\366\335\031\275\034\205\202\351\266sw`\271i\303\204P%\313%\345\014\307eN\326\272\000\237)(""\\z$\301$\227\235\333\206Qy\330}y\217\243\010\035\363\275\200t\301x0\034\023\"\275\t\230\272\220\3609\231\203\261\307~\232\370\001\246\273\211\203%\022\321\252H,\251\256Z\031*\272\337\255\254;\\\274\206c\241=\022!\262x\177e\007\005q\353\016\352\216\314\303\360\367\305\006\231\000d97j4\341~\030\257\375\353\254\353\035\247\245\226(\001\243\343^\311G\366V\207K\310\216\225/\273\200#\331Gul\232\013\361\356\350W@\036\361\322\010G\367D\033\250VM\205y\206p\234\007\256\373\0208~m\262\345\246\270Z\213\0013\316\346\347\216\003\016/2Y\204mX\375\205#\366\373\330\260\343\276\236\217\202\024X\302\016\210\334W\233\336\250~\356v\013\207c\213\030\014\036\217\004\"Z\323i\313\200n\245\305+>=\315\3429\0072\3317b\2103R\350#[\215 \305U\2054\037-I\263\244\320\257Ah\304\321\"\\#\343%\234\275\331c\005\007\205\255o\377\231\226\201\026\"\005\354\022\252K\253\346\376%\330\005\205\266_\021\210\361/8b:KH\0233\274\355\265\245\347\033+|:\\!\326\314\2339,M\356\027\265u\255e\217\323\304=u\352\277\327\357\013yUla\201\243\337\337\360x\001%\223\203\241\344\314\327!i\177]nmhr\337c\235\334\033\3239\233\373\223\364\354\221\320E^\266g_\253x\274\177\3629v\r\267\362\"\025d\204-\t\3232\217\330\223\014Ty\034~\324\265\241(j\337M\314\037W\n\221\nW\275\356\223\335H\324\333\306\276\220\272+[2\026]\233cP\377x\212D\207fT\316\252\022!nf\326\246\234V\t\235\320?\300\264:\320=\232\336\312y\\\224\346T\020ui\020s\304\032?\177\227\314\260\255\200'\241^`7\336)\241\227\036j\035y\341a\304\334\334Pa\004CI\3639\201\226\252x\324bt7\263U;$\344;\211\300\177\317\304V\255\361\262,\3047\314\014\023(9Jb\027\n<\247\226T\310\025\177\255\013\314\364\231\211\017\327\261a\2158y\226M\016k\226+\\\344\214\271rO\266\365\344\363 \001:\274T\327<1p\355O\316\003}\032S\306\226V\341;\306P\371ZPOq)\226i\362\265s%\232c\227H\321\014\274E\020ZD]Ql\032\344-\002x\263\0064\007;.\177\035.\205\024A\254=_\003\336\020\020\004\257\276b\203%\322\237\370F\365\301\205\3305\255\"\206MU\304\305I(\221e\215\260Z\024\367\305V\263!\\\265\204\032\002 F\301\214\210!]\245<""\314\255\204&X\302\241\235\372*7S\232H\361*N\254u\034\324h\017\217\021E\362\032\036L\207\241\311\335\354K\023l\010^\240e\335\354;\261v\020\032+\303\016\010|\313\373c\370\372\033&\256\344\317\177\270\315\272\025:\rb7\303<\347\276`\207\264\005Q\365\255Ma\1777\333\300\322\260\007\364r\356\002\2438f?2A(\322V\351\017u\312\313\341\346\367~\013\naehu\236m\376q\332g)!_\376\264u\254\300\250\222\377\310-\355\312f8>\014T\025\336'\314\014\264Q\3435\210G\340F\307\014Fu\265Pj\254\302\215\342\n\202\201\375\203\010&o\213\023\202P\275\237B'\021\235X\270\334\"\250\254\014&F\233u\315\343_\376S\003!\255\245\371\250\257\303\235p\333*m\245\004\014\243m\363\235&\023\324>\274\037mBbP\034`\212\231o\241\242\234\214 \304_O\276\312~\024\204\341f\001^U#\273\030\345z\231\300Vf\244\020\035u\272\373\304`\241\227\035Q\260#\000\007\230\275\206KS_\221k\375[\247\327\366\310\256\320\340\257\222\014~\\\305r,\001\036 \002\221;g\032\301\013\366\265\221\261\005\224dR\304\201\211\210\3015\210\322\221)~\326\310\250\025\343\303\007\347\342r\356\264\0025\252\341\352PF\360\022\367\232O-\\\320\241\307#\210\333\030)\005\010\331\221\223\253\310\261\177P\203\3621U\350\331\346\032\006\331/\237\315\351\251\276E^\020\232&\221\017\n\211;\245\366\376\247\013CL\206\244T\301\263N\0330\242?z\277+\377\302k\346\032\211\373\0015\016y\261\255\355\277\201\215\200\362\331\340#\231\\D\364d^\232\306P\346Ma\313\"\305\234\345?\366A\311)\321|V\356f\r\002\230\317B\203J\206\350\200\370\rs\213\265\365\301e\254\264G|\211>61\263\021J\266\213\3022\306M\225\t\034h\021\320I\030\030\030r\257\371B#\225\3011\256$\300k \006'X\312\240\310\t]:\t\207\343\262\271\003\007\227\331\001\354\025\342\245-\220A\331i\243\t\237\270\260\\%#\361\246Hcb\255\355\020c\224\037d%\247\377\215t\372W\316\373\215:\002AG\210\356(T\331['E\r38\031\275$\237\270\251,\264NI\335\005\217\324]\332mV%\243\266f`u\361\"(\335\321\034 \320\262S\376\224;\227\250\222\307=\247\027\271c\224\215-\025\216&\030d8\216\337\277qvb\334\305\354\354\272g5\200]J\001\007ki\356'^#\312 \235\230\273""\350E\200f\300\3077u\352\225;\237\310\377\225*\352\357\023\356\314\254h\237<Q\203\025g\032(\353/2\274/\200\273\277\262\317I\205x'PK\260y\265F\202\324\025\001?:J\343\230\370cv5\271\032#h\300A\304!\312)\373\344}\353\274w\224]\315\237\005\016\331a7\353-\331\345C_\031\302|\260\2436`~\350I\037p\273\336\376\347\210\342\301\240\223\026\332-\355\275\260h]\024\013>oL\016\236\331sb\324\000@\312\231\333\007\200\246\332\371}i%\237\203\275\343\260\013\002\201Q\007-\345A\227\234\177\014\215W\367s5\362 \005T\256\232\007'\340\204n~\225r\3337\013\302\220\216\353\300\030\235\007z\207\246\006\3250\350x\364#\304>\022\251\024C\037\305P\272\214\347@\215dg\017\267\347\244\002u\374/\337\035\330/\017%8\305g)\203\323/\2753\301E\314\314\340\300\006N\300\000G\341\344\177\252K\022\344A\371G\326<\262\337\314\25569l\361\325\335\360\230\214\027T3\350'\303\202\256\213\214w\010\205\335?\241v\363\013zh\202\345\024\226N\367+\332\016\017\373\023\306O\316Gu;gD\016\223\255V\025\375\243\305\216o\233\224I\020\376\204p\364\221]*\2341\372\350}\007E\371a-\261\330\2631\271\240\351\324n=P\023%\347\026\244Y\t\306\013\245\022\220cwKq\274>\246r+\241bW\033nu\367\242\031\266*\016G\r\220NG\007";
    PyObject *data = __Pyx_DecompressString(cstring, 6023, 3);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (5922 bytes) */
const char* const cstring = "BZh91AY&SY\312yW\221\000\005\034\177\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\300@@@@@@@@@@@@\000@\000`\030=\316\370 ]\203Rk{v\343\336u\367{\301\354\356k\245\313\351\352\357`\032\342\327\241\351\350\000\000K\320\006\245\240jvx4\364\333&\001\362h\200\006\232D \2150\032dC&\215\0233Q\242d\321\2514\033\362d\030\211\232j)\221\355O\321SFdjh\332\233\325\032\017\324\3210\206\202I&L\023@S\020\204\365<\201\252~\222=F'\244i\204\310\003!\240\320\000\320\000\000\003#F\203@\006\231\002(\205=C!\241\243\020\000\000\007\251\35241\033\325\000i\240\000\000\000\032\032\006\200\321\220\t\n \244\322\036\247\244d\000z\206\232zM4\032\032~\246L4\241\240b\000m@\323jdz\217Q\246\215\036\241\241\236\204\310\200h\246\222\003@\003@\000\000i\3514\365\006\215\037\244 \000\003\324\310\365\001\240d\000\000\000\000\t\021&\200\200\232i\240i\030\203L\232\233H\323jS5=@\321\3524\365\000\r\000\r\000\003 \007\250\000\002\320\275\207e\260\313\351\364:0\216\204is\206\266vZ6\204u\320m\201\270\034\267\212\005\222B]\031\244j\244\261#\225\020%\021\313 \330\267$\274\306\t\232\243Bb\001s2\311\360%\203\211\025?\3430\377K\001\262\t\014\2130II\022$%r&\236\270\177\344\017E\327\336\024\275+J\365z\275J\240\214X6\t\003\030\332\006\321\213N M\266_\212\276\362\373\314xR\254\234 E\231\315\002\314cQ\215\t;o\214\220\200\314\333M\252\266\331\010m\207-\240\031\363\301\234y\325)\274\300\325a\244\301X\\\323\023C\006\r0i\211\266\024fH\021\221d4\262\276\305ki\r\242\203-1X\206\0103\213J4-$\322\310\210\266\220OJ\272S\270\245\010 B\351;\n\"jc\347B\203U\026*\211\202eg8\n\024T\240M_\2122\030L\311\014\300\314\204\014\232\241JA\211\251\251\204\361\214\037\030\261RO\260K\270\025\242\236Q\302%\361\026\261N\006\030f\0312X`Z\324\262\323 \014\331!\231\231\006\014\300i\316j\260\260\325\316\340~s\233\363\206RYu\022\"\252\266\035&\212\216\332\230)\024&\351+\2234\334\344\303\0142d\247\027<\2424\031\231\014\310\231\336\237e\263\211\205\331\335g\334\267g@\t\3026L\221\337\204\224t\300c\341\304\232\333Z\220\335 \227.0\372""\347;\177\342t?\366rp%\236\213Z\002\232\343\245\231A\014@cq\\\255V1\335\353\337i\267O\205\225\333\305\332(2As\010\370\270\323\350[\253-k\205\336\255\260\266\322\022W\302\220\225\032\341\230\244t\241s^\323\223B\253\027mz\253\rU[\336\210\177\034)J\377?@(\026\302\374\214.\264\034\357\257\007\220\320l\362u\337\221L\013GRZ]\204\235\243\240Q\230x\3709\331\207\261\244\302>\306r\270cc\213\354\261 \263#G\177GI\272\331\307?_\014-,\250E\313\350\273\n\326\373mW;*_;\375\227\306\367\306\355\320\366)[\357\342\316\031\314\321\316q\375\262\371\267\027\245g\222\224\262\252\276\2162k\212jg\3739_fZ\232\206\014\265\346\346YM\206\251\222\335\205\223i5\2633\215L\347\305\007\341(TcJ\254\332C\027Z\261\215\311\346\210q\027R\347\026d\376\021\303U\366m\233\365[\311w1v5\355;[\360\203\325\355\356;\217\000\3441\313\343\004}j\343\355\360\302\217\343\003\332#\336/z\361\017\270\371\n\272\346&*:R\223h\340t\210\240XV\330\207j\353\256\276Mt\013\343}\367\313Q\267\243\021\233r\263\245\022F\030\341_LG^\301\212\306+\037\211\237\027&\227k\242\320^\351\013\300\314\313C\034-o\215\225\240\255n=\346[\341\355\231\231\223^S<\034\005h\001V\250\317\032\260\033X\030\026\014t\031\277\241\023m3\333c7\347\236<<#\323:\344\372\322\360\330b{\336\312\\\251JG\225\032r\271\324\251Gr\323CI\276=\031\314-\025N\276\275\275\324&O\325\027U|\247K[W\252\362\252\037d[I1\344\253\224\251i\215H&\262\010'\276-\313\372sf\027\3334\262s>\013\016O\261\250\201UB\305\001d\225<\213\367\356\342\214\362S\006q\223$\314\002\344\337\274\247ip^!\244c\321\026\263JY\232\261\215\213x\333\214y\024\310i\344lo\216\260\354g6\217g\005\212\252\351$\265\254uF\004\205\265\017\212\007\250\210q\322\3354u\366\3663\367\246\037\324'\n\r\235c\203\201\314\256\307\320l\200~\362b\210\357\374\345\36689m\325\235s\234\004\255/\346\263\367\3661P\002\232\256\222\306\207@\216l\273\214\331e}\331\322;k\374\375\244\253W\251\034\200}\023\310\340\352\026\344\036D\035\313\313\207\255\354\024\243\245\007z\277\003\0140\031J$\312\023k\222Z,\272\224s\005\006\014>\031b\332p \"\306\232""\025\227X\306\003\310\272I\334n\006\347\2304\321#\326\335\365\235\201\305/\223\230\254U\025\250r\355C\325\234\302d\30554\245#[\337Y\n\342@K+Or_\204\263\246\023S'_7\354y\325%\207\014+Zx\222\3445%\337+0\216\004\321?jBG\342\255\213Sk4U\033\222,Y\003\\\221\310\352\202C\010$\306!QM\247\352/\013\220\333\223\257\312\267\034\362\010\366\340?\312J\024\276\2367K5\205\301\216\252\034| W\356k\016<\211Ro(5\250\350\263\016J\265G6}\035<\241\370\311,\336\265\020<\271\343\211R\253\r\326r&\300\024\304\315\276f\334\216\221\207K\323\010\226\240\021\261nS\201\035\223\311\226\001L\202\241\351E\010 \272l\255f\223G2\341I4,\373y\375\037Oo\323\273c\330\222^}8\206sN\231b\375(\377N{\364\245\271w;\2725\240\300\325\022]\243\2778N\234'%Mp\225?\260\257\271\247\376\021\263\3239\324V}\013gv=c\267\313\273D\333\370]/\243\341\364}+\370_\t\016\305\035!\241\301`\212k\365w\333\265e\327\242\005\331!no\324:9\333\314a\033\005\2518\010a\205)W\234b/\007\235\246\222\335\236\036\267\253\020\333\225\"\256\330\254\345G\252X}\276J\331\373\325\351\352\306\206l\331\200A\250!N\370,K\r\355T\325\320\322@\211\243(g\312\371\364^\230\216L\356\253\376h\246\206c\317N\322\322\313\376\274\220ifpY\225\254\376\250\334\177z\000\331a\242A\0357\017\303\257k\\\275,xdz\370\353\202\367\031\032d\304/q\345\250g\317\221\322\203\260\272*\273^N\r\231\360=\340,\030\262\335\354\323\314{\226b*\256\326\276y\3701\331\360J\006\232c\033\017\332\210\261\240h>\317\257\023x\033\221\277\326!\202\350^\243\302iS\374-\244\226\013\317^\250Q\2420\201N\351\326a\304\233W2\022\t\r\240\332\340S&DM\352\271\372n\305\350\337\325u\352\332U\230PH\357c\250)\000,JQ\274\231\321\302W\033 \326\002\322\340\007\307\372\354:\032\367\356P\301y\306$\"Ff\220\2544k?B\2151\273\022\211\001Kk@\202k+Jrj\354\345\326\256G\037\216\201\371b#\237j\332\215\241\267\256O\357\372r\003\213\250\360'\256\232\367\323h\232c \244\211;~\223\037\250\356\217\267\306v\245W\205\361\010\202\323d\247\351)Bz\353\315\314\235\034\010\343\003\016\300I\036\037k\257\336)\334\262\242\245\027~U\351\237nx\034""\217\345:\334\253\3377\237\266\355\313`\326\336v\375=\372\225%\312\272D\302\021\276\365\024xJ\247W\305a\353^\345\010\311\031\243\333$8\201\304r\216\335l\377\004\340\221\330\302\204:9CR@\235^V\270H\303Z\272\222\237d\272\272\003\245\311\230\233oZ\203(,\272}cR\265\356\242h9\224d\363\r\335\3747eB'\230\231\220\343\253C\336\371^&\217]=\327y'k\234\336\226\266\265&L\354,\222\223i\003\027\"\030\013=\340\220\004\346F\300\321x\0242]\004\231\314!\256(f\2010Q\247}\021\277\252\222\025\000Q\272\360|\313\027Y\275\374\231\261\031\026/\335E(6\00338\300\267\240\233\002\370\020`\231\202\221\330\305\034\2766\r\330{4.\022c\006\326\351\343\201r\014\233\213\363\275\304\006\002\rs\007\217\334oKq\356\337I\306\31134\363v\205\303q\247\303\355pYy\374u\221\327(o\177\202\0067\0341\365>\002E\334\373\343fezS'\304\275\222\350%\004\213\370D\227$*4%``\204\033D\033\323\030;\022\314\365\320UZZ\3461Lu\010n?\0351\033\025\034(\362\242\357:\024\270\347L\031\031\263n\312\340|\016\324kX\352rqpW&\225\311x\374\240{\200\361A\361%\342\217r>\241\363R\265\216NF`\022,\212 E\220%F\\C\313\234\273\024(\221v\036\311\215\235>T\304\227Y\223\026\276?\367\033\242\362\"'\2705A\t\270i\273\254\307\004):\n\024\221!\024\241\367wq\213\261\r\244\305\353dk\336\373v\245\357\347\352f\346c\373\227q\031o\314\tKw\257!\327S\354`\030\266\r\236]\362XF\032a\215b\342\007\021\242\353\337\307:\n\335\215L[2\262-\356\325Qx2\372\3370b\356Ip!\241\005\005(\324\315R\265@p\327I\241\tkd\r\203\006309<\22507\233\367\233\367\256\354r\014\210xL\261\311\3329r\021\232A@L\026Dr\216\022A\374\260\342\307m\006\216\001\334\007[66%kA\024 \331\256.\307d\206i \\\356s\"\372\332\261\234lH\014\330V12se\007\307\357\344\361\313GLZ\222\275\207\264Y\242b\210\256&@W?\237\224\345\016S\317\277\213\213\247\r\301\321H5W\217\235\376g\267}\263\016\236\005\310\210\263.\233\256\311m\032\3017O5\260\0035\342\224\350\032-\010k\260./\316R\322\227\2207}]\343\025\036\r\243\034p\272\2431\271K$d@\030\003\230sa9\276\266\024k\367\300\013\005\220\314?\010\275\02720\344\304\271\214\233\233""\215\345\357`\022\213sX\361o\201\000M\345\255\265\303\252\033\036k6\325\333\241b\021\364S\016e\206)i\320\201h\310J\377\204\333\270wnm\222\214si\254\210\261Q\272\231l\326=\021x\364h3a\276\204V2\037\024|yFd\027\211]\276\353\203\237ly\351\017;\000\270[\310RK\351\211$\021\260)\255\256\003\266\343\016\266\002\030\004&b\244\020\253K\355,\274\177wu\226\253\260\314\256C=h\200\200`6\306\206\330\300m\264\207\334\242[-\203\253\n\333\273\267{\276{\337\017-\344\231M\344_u\322E\211GN\242\213\206\315\227\376Pv/O\245z\373<~\363\037\203Vq6\330\315\272\001rqm\221*\200Q\205R\032\333\026HZ\275\332\265\032\2745\344+X\233L\030\206\271\271c\034\226SP\253\363\373\032,\246\373\002Q\362\331\315\301\207U\365\262\312\322\031t\313-~Z\301JE\031\336\375V\373\246\332S\227J=\2122R\253d\244\304\004\352\202\317i\304\373\364mM\241>R\020b\334\326kQ\302\017\000(\202\021F\221\220\360p#\224 \217=\307_(\343\2350\371Hi\333g\247\311\304tn7n\301u\t\035\343\033O\034\245\351<\r\315\014\346]i5\036\317&\023\317\362\214\366\342#\223\216\024\244s#O15\302\253\244\024\220\216\267o\261\344x\333T\214I\305\346\216\364{\203\t&5\336L\211za\2676\014k\r=\273\256\241\031y\246f=<\242% .\327\2578l\017\030\371\020\306\326\032\016g&f\034\266 \224\233M\352\343\344\256\266\0273\363\323\354\347\340]\034\366A(\335\354\\\234}\376\355\373\025\022F\3000\352\\\347\314\312\207\275\244\221\333\267\250\000\331N\376\356\337\213\227\240F\354\256\350\244}L#`P\206\\\036\244\271\355|\314z\016\304\341\265\035=>M\371=\311zpS\nx\201\266\2078\204`\220\325\324\212\330*V-I\350\255\224\026\246~ZV{F|\376h,A\222j\366\226/\2049\303\233\230\361\344\326\260\356K\331\004\260\236m\233H\343&\350\213a\372<\3248\372i\216\2601bC\013\214\216\366a\300\354\3612Z\013\331\221\203\364\344\"y\372nAjmi\262%\226\341\022\026A\321!\256%\023\rN\211\323T\263\237F\225\032)<\325\005\356\371>\257\232\272\307t4\342\02411\267\021\001\204\314\353\222\0052A\000\304)x\263W\003\272 \327\252(\313\030\250>D\303rE\317$$\353\215\000\2401\241\007\316E2\006\322\002\035\020\020\344\233\007""\212\3410sF\3615\332\227\r\001X\222\013\320@\341 (\334\375k\204RRD\342\240'\223\222U\311c\207\204\0042\316\331\316hV\003\007vx\336\031\214\264V\256\220\241#\225\tF\200m\024b\210\201@\330\307\0234\230\242\271\r\276)J\013\035\261\035\232\266r\035]<Z5\016\341\206\003%D(m12VS\315'70(\270\017\241\200\372!6\331\014D\2768\331\355\264\370E\371\266h\252{Vu\264\315\025\322\226\246\007\335\021\225O[Laan\224j\006%\230+Rj\241!\305Wi\2302\350\244\200J\206\332i\204@\304\230\330\271O?\232\r\005\225U\304a-v\240\322\375\251\332\221\261\356\202\252\324l,\247\304a\210\025\200\320\240\330\203K\r,k\026^\314\"\210\270\217\036\273%\024S)\275\237\026\237f\227\364\242\375GHJk\241\216W\272\303E.\312\\\225\255Y3\225\370\302\2610\357 \311\316F#Q\364\001\356\034c<-\252\020[\337i\343>X\303\377\275b\364\036\204\210\366\002\177(\007b\371}\245(\325\303E\301iB\003\214\034:q.\342\013\206/8~\342'8\023\010\210t\234\212\211\213&\353\244\266\265\257\021\235\236/\221\256f\024j\021I\231\031J0\331B\202V6\370\346d\212B:\021*\300)\254\017/\337\361s\260\273\216\n\204\3261\315\275f1d\2638\307S\323\352\303\237\314$/\006k\315r\363\244\326\255\216\227\2177\253\352\366$p\336\030\265\327\341\301D1\031\270I\036Y\034,\246\325h\206\362[.\370{-\000\326 \215=\356\266\342]\312\2134h\316}t\224\023j4% B\365q\345*\005\312\320\241V\251\r\205\232\242\347J&\372\372\272zC\314\267 \271\347q\353\317JE0k\027\305Y\230n\233Ki\271\236],\242\211c$u\205BH(Y*\326W\013d\341\351J\311V\331z\022r\21257\331e\005K#b\301\004\031\r\220\253*\255N\361\031\231\324q\206f\211bG,t\347\325\226li\252H\r\020[\316\363\221\177\205\236\323u\203\236[S\374\352\346\031\275\253H\236\216f\340\334\030\025.\327`\204S\306l(\263\205\355\242\306\026\200\3662\206\226@\332\\Ln<\261\325Jp\347\317m\331\017\325\234\310\312[\322\270\206\256C\265\304\013\266{\240!\257\263'Q\223\320\226%6\277\314\335\207\235K\331\262\225X\336\354^\330\006<\350\347G9\311\316u.\216\242\331\346\356\006\227\231\310*16\2213\271:(\335\010\255\"h\014\263\206,\272\332\"m\264\320\0010\\\007zD\0141bXF""\366\244Z\252.\357\321&\210$\300\256\211\240P\251R\372\"\243W\330\025\224D@8d\024\032\002\331\351\220+\313\013\";\"\212\321\001t\"\017\203\020\013\003\010\013\355\242!\264\340\222]\371+\n\214\3153\\\321^\215\227\362\25057\204S\026#A\313\212\257#\315\327u\204\326u\263R\030lz[nL\353]\372R\n\3033\312\363\\\2224t\273D\203#K\320\313\366A&\023Q6\364F\207`\263\032\374\355c\264\235\224\336\203z[\326\365\277y\334w\332\253OA\264\332c\260(\300\235\205\233\365\323\341\331\351\334\225D>N\224M\004\316\207\303\332@<\t`9v\203\021\255\330\231\347\277\260!u)\016\2139\010\032\r\334\350\3439\371\014xq\303Z\\\226t>\207\013W\242\2735\024}bi\214\276\340$\035\216R7FWv\374U\326|E\006\205\333\320o[\326\364\2738\231\261 \331\204\352\363W\247H\276A\335\014\207q\326Wg\226Yr\366\364\334\275A\034\334\336/\322\357m\341\214\202l\342\024G\000\260\202\325\367`\261YC\236\307B@\006n\223\020\nrf\035\212IU \200A]\340\367\340y\251Mo=]@\373\357T\374z\230\222\274\266\311/p\300\247g$\\qy\303\357@x.\341\226<\241\205\370 kb\330\0336\037\202\264\002\027\234\335\272\333m^c\315\266\244\264\266\206\376c\246O\355.\246\257\235\373!j1!\201\300`?\337\203\326h\177\232A\226\317\t\245\0306\270\354D\325\355hx\237:\251\244\273b\024\030\330(\330\333\345eo\"\303\242\315A\363\214K\247S\203\330\334\201e\214\304E\302M!\3210\210M\254\277/^\236\003|\216\204_\225\223\245Z'\307\014\315\210\020\345\3559\n\252\316#:K\201\233\344z\333\032\301l5\251\007ua\374%\256\314\266\316\024G\014b\240\320p\310\322\032\327\t\363\376\021+\006\311\033\273A\327\203\003^/\033I\027\367\331Q\264\305\007\276\337w\177\240&MH2\211\2623\225\350-\2523\317\234W\003\257\313\352\362G\321}\237\2633\253Z6\2061\346\302\\\354t\030\306\332V\331\n41\220`\334\207\337\233y\230\360f\37506\344\003\010&\221\t\310*\" \016Gv<-\255\275\261 \307\3313\370=<\334A}\201\240\257\334\3328\331\324\037\032P\317#\242\205\nLMW\007cY\317j,\3439C\222\312={\254\243j\220\273FUZ\330\363\363\263\263\365Q\240s\352S\0176B\205%\006\301w\3715\250\325\016\220\307X\243\346\210\\\341Pn\374\301\201P""\\U\270\247\265\211{\234\013\306\367\005\001\340\026w\013\204\241\337\265\323\304@m\232\200\201\004\306\377\364z\231t<\027\021\300\363\370\270O\177\314\347\217\016\031\031\243\231\334R\367\\-H\241\033\0364kl\342}\263\375ZU\300\367j\307\351\350O\320~\243V\336\\SI\206=\344\241\27264\331\207O\231\223\231\314w\351\304^\316F7cZe0 \345p\270<u`|?\273\355@\374\2749q\2518}Z\221\335\324D\261`\r\005\366\2727\236\036\255\2408\032\221\"xD\235_[\270\027\253\017r\235\034Dr}\217\327\207\310\324\340\342\354j\216R\027\000RC\261\21304\340\3720\202;\023\n\342\367\310%\013\275\234\375\214k\034\017!\346\300=\243\366\263\247\235\317\207+\316\207\235*:\212(\355B\270r\365\225\362\364\2567\022v1\320\270\373\036\307\221\357\374\363\314\216\354t\361\363\"\021\213!^~\217\267\340\310\332L\363\306X\356:Q\247\034\256\356\256~\254\233}\3758\362\007\221$\202\231\035hb\341\305\207\352\001:xz\2722;\031\337OKDu\rvC\205\2570*H\373\320c\304\304\347\306|\254D\r\351hp4\217\261T9\010\311drs\363\364\006\272\201\314c\300\005\361\307\353\346<\270\216\004'\345#\224rr\362`\355\262\3348\000*\314-\304\016+\242\002\200\021x\225\013\254o\243/\245\337{\317\226\377\252\255\327r\270\274q\224_\345z5\353\226}@\205\2045.v]\342\275y\203\256\347\256\367\r\373\256\002\007\025\354\272\202\235\321\351\331\270/^+\302?x\270xn\205\253\353\037%\364g[\244\033\010\004i\017\214 \320\222\375`&\261\353\006\341)\n\361\266\232\204\373N\245\246\3107\344\2021\002\363n\3500e\264L\262o\003\305P.\003\330?\213\264ely\334\013zAh\341!E\346e\227v\035\250\016\031Nl\254\310>`}\021\020\236m\204a\331\026\366G\203\342\213f\316\201D\370\217\360\265\016\370=+\315\212\324[\366\214X\007\036*\206.C\307\305\260>ZA2\372\274\234\202\375\377\001}r\353\336\353\330\2628o\330K\276-1\373?/M\335I\272\023\244\353\235\220wrP\214#\316\300N\317\022M\325\322\035\2375\361@%\207\323\203\306\026\333\3025\204q\331%c\216\335\251z\265\344!Bt\367\0220{\330\000\366\024\242\231\317\021\211\374\35425\22163\214i\322\270\204\334\271\235\035\262\263|\243\014\316\374\031\364\371/""\337A\361\236\274\276x\006\367\205~:\274\204\025_}\344\343\360\3439\007W\316\237X\037\200\360\324\036i\274\311\313\231\366\303\335\025\275C\026os\233U\354\253>B\302\0361\264j\025\223$\271\227}\030\230\246\233\004\033Ob\355\342\005\353\021r\r\335=\303\231B|\342\244\332\235!\342-\034D\013\231q\022\366\036\223\212~d\305L\313\213\214&\254\014)\305UD\265\227 T\264\\=\324G\270\221R\324H\270t\240DM\232\221Nl\301\304\027xn\217\031r\240\205\212N3U\225\225\0057\025\251aM\000\200\300\247\343\023\206\021E\n\261\002\033\002\344:\223\232V\350\\\270\255\233Op\361\025pK\013\272\"\243\030\304\321\372&\360\344)#\004\334e\014`\232\262\241+O7\256\244`\301\272\275\341\345V1|A\2077T2\344\271\2210\372bc\310q\276\266\241\240q\363\223\236\202V\236{\024\245\003\004i\240\221q\021\032\023\356\2606\356\260\255\356\264\326\371\016=\343\033\253\316\264\231\377\305\334\221N\024$2\236U\344@";
    PyObject *data = __Pyx_DecompressString(cstring, 5922, 2);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (6081 bytes) */
const char* const cstring = "x\332\305[M{\323\326\266N\016.\230\222\226\030B\t\020Z\031\222\342\204\204\036\223\300\201\264\364\324\371\200\204\222\220\330NHi{t\024[\261El\331\226\344\304\246\275\037\303\014=\324PC\r5\364\320\303\0145\3640?\341\374\204\373\256\275%[\3710p\237s\237\347>O,K{\257\275\367\332k\275\353]k\313\360\327\005\271 \033\362JIU\214\222\026\033\323\306\027\224\214\361\253\242\032\223\002.\277\263'\335\320&\205\204Z\377}Q\323J\332\254\220\221T\265d\010R&#\353\272\240g4YV\005M\326KU\r-\307\205r\262\201\256\035\364\346\005M2daG+\025\3751\212\272S\362\3055##x\367;\222R\220\263\202Q\022\244lV(\226\262\2620\246\321c\251j\224\253\2060\246\234\022d\313HjV\0232%uG\311\261\265\364\017\210\235\326\340\003R\272\362\376\214\3114\331\320\024yO\026\214\274,\024\024\335\020J;\320\226Y\362\264\264\216IUy?8\245'\243\250{RA\311\372C\361\234\225k\262\216oa\314\237\247\244\026\352\276y<+xO4\221@\226\336)U\325,\256\232\337c\344\025]\310*z\271 \325\205\274\244C\312\033\313g\025\252jY\312\354*jNXz/\304\360\201\274\264]\302\216\212RM)V\213\002\024\253\312\302O\257^aw\277\246\253\345\202\334\205\306\357\254\221\356V\340\241\202\242\302KJmL\371iL\027z\377\255\226T9\t\333&\347\260M,\255\307R\314 \363yI\315\311\253%C\331\251?\033\313\362\265N\2548)\234T\341\304\363\033IS1\347\254\260\305\226\020\344\232!\253\272RRig\014\262{\360\207\264]\220{K\302\253UM\205\317|\267\300\303\252!lK\272<+\214eO\016\334\22356,\223\2273\273\236\273{\311\300\000\331\222\3145\321\253\345rI3:x\351\214\361\203\313G~\247#\010<)\353\243\240\254\225\312\262f\324\273r\276\336\213\013\313\013BV2\244\331\323}\320\310P2R\341xh\352e9\243\354(r\026\033U:c\200\232\371dz\236\205\n\203W\260\307\013\023\212\017\016\300\255dr\036\372\021\245@\371\2161\321\234\222\215y\004\371<\213\317\330\330\335\332\244\300/J\217\017\357\034\347C;\014\325\035w\2676\356Y\341\031\311\347\344R\021\021\t\364\350B\214!Q(\026\307\275\225=\220\261\265\023\360\tm\367\204rg\210\214\351\230,\330\233\302F{\252>>+\374]\230\025\204\357\204\007\343\302OBL\312\030\312\236,""\252RQ\246y\340Q\221\007\277H\216\215\215\351\307\006\243[\346.'\341q\201?wI\017\317\024\251\014\023R\241 \370\323\n\360\200/#H\032u\022>\352\024\371\204\364\254 \021cN\216\221\2773\325\002\266u\306\372;\343~og\2211\355\303<\357\365\226%M\227\031\330\260u\257\215\270.\300s\264\213\242dd\362<JD\006\032\221\201\346\243\344,d\n%\004\026g\365)C\301\246\r\251X\366\022\006\273\004\r@\r\272w%\254\262\000\300\344%\241 i99\313\262\035\254\306nh\253c\n\300\256\371\266b_\324\234\255\026\213\365S\323gK\306\024\323'[V\236\311*\r\tFe\221\250\263T\310\312\032\263\340q\356\347\372\362\344D\232\371l?\316\365\344Mdv\335'r\272\236\242'\237Kx\036\315e`41S\3254p\224\310\265\214\215{\366\023;\256\342\326\"\264L\372\031\200\335\373h\243I<}D\217P\024Y'\240\217SWM\323|\3442\247\305\306\237\345\247\364]y\037\327\272\232\231\222\325\254w\007\337hF~\312(\031\340\026J9yY\311\345\215\251b\021\321\350\223\017\266Z$\234\005\237:\235\236\245\325jq\033f$\336Vt\221y#\376\030;\353\344\310`#x\210\355$z\272\225\223\353\251\016\006\263\343\255,\303\036k\341X\364\rN\030\202o\301\241:\367|vW\226\313]\0101\200\363\340\t\244q\001\034\304\355\314.S;\005)\247\373\022\035\375\374o\314\243C;\356\364\250\267\255N\364\250\245)\246\322\024s\302\t\362\305\243^U\014R\214\207\014\242\240T-d\205m\231CI-\251S\260\321\256Q*\007\312\205X\367~\222\233\200]:\304\352\303\305\377\236\014\206x\247\223\300[F*\221\201\303\354\024)]\326\224\242\244\325\247\216g)\205\262\004\341\326k&\242\"\223yYh\212\262\320\361b\021\023\363\270\342\234\205\036Y\333CP1\366#si%R\206H\206\245\370}\220\320\230~\254n\013\336\263\t\211=y#\253\261\212E\232G\2478B\220\210<Dcx\236\342B\334\334\262a\364\346\005orb_/\257\313\331@ND\221\266\253\224\313\362\351\244\215x1\252\024\201zu\273\254\324\344\302TI#\3720J\263\344\366\361\000\377\023\376\212\222ZgE$\203;e\271\361I\001)\2174\3532\020\225\243\304B(H\301\nZ\235G\243g\006\350(\301T\263(\376\030V0\254R\225\265\3721\276\326\250\026\253\3524\255\\C\225G7\236\032~5\316\310\201\231\223\247Z.\355\005\363\244""\367H^z\306o\275\351\331\360\275\016m\354\005hc\217\323\206\027o\260\311\276\222\005\227\024\213\302\276b\344y\031&R\031\366\254\026\217\373\276\311\260\262q\212u\336\255\325\312\232\364\035z\277\333\366\212\313\357X\210<(\327k\211\271\371\205\305\347/\226\226_\376\374je\365\365\332z2\225\336\330|\263\365\313\333D\372\365\312\334\274\244\033s/\222\363\211\344\302\362j\342\325\374\353\325\325\305\371\364\362\353U1\225N\316\247\240$\273\254\3129\211\222:{X+\351\n{\240p[P\366\224\254<W\177\210\002B\2253\000\000\226Kl\274J\213\311\305\347\311\305\324\222\230L\244\027\217\235\266\350l\265\240\350\231\316\200R\025\036\341\263\261\333\024b\215\022\353\213\304\312Jbiq\371\305RZ\\YYJ\201y\327(\022Tc)\250\324RP\251\245\367\313\253\351\305\027\213\311e\0251U\22022\225\353\257J\271\234\254\255$\266\304\325\3057\342\312\353\205\305\024]\304\347\257\022/R\264U*\317\327\010\210+\325\202\241\240\270\256\211\342Z\275\206\017i+\256\"\021%\345\235\344\213\271\344\353t\202\354\223\362oD\330\014\023$\251\356;V\340/\253p\257\2329\273\361\3011\213\234-\"Rl\006\362\317\203\037`\"\251\240\377\370 '\2532|~\366\260@\275E\243\316\026:U\220\234-FY\020\264\341\317\327\245\263\336\342\247\363ioYoZ\020\266j|T\212\324\024\213\305O\222\323?Y\360\223\244>M7\306\036\275E\275\000\377\200\200\227\002>.!z\247\333O\220\364RUo\311\223E\316\331\222\250iX&\352\335\313\260tvw\267\2728\273?\220\351>(\360Q\217\350\010\252\214\227\317\370\306EN\224\372\007\345}\030~X\364X\236\354-\344\255\213c\271\037\002\365\336\302\037\335\021\363\316\007\004S\033sk\313[\213\257\210\303R\033\251\265\305\325\205\305\205\323o\026\322\313+\213\251tbe-\305\336\034l\250\273(\031\324M0\377\346\363\271M\320\332f\220P7\203\204\372fy!\275\004\372\335ZK&\300\345\253\013I\221\361r\340\371\030\257\006\332\273\253n\321\214\301s\341\211C\341\t\316\"\312\341b\250\036\324\254(\351Y\260\260D9S)=\310\2244\030YQ\321m\224\212R\225.8\325S\212\244A~\016\334.T\345\355R\251@\007<\232\364\024\345e\350\335\r\034%\032\032\322\304\266\224\331E\001\251R{I""\227\271\233\371U\354\034\277\274\234\2050\306\235\201\244 \262Y\031\201\021:\030B\350\370\306\316\035\031}/K\347\260,f\313\002\276\206\306\317a\264\031/\202q\240z\372\030\027\374\3210|\325\360\251\313*\215\220\325=\332\000\276\024JfZIc\027V\014t\313\002\271\306\227\244\263\022S\010\007\323\035E\323\r\246\266(\356T\325\214(\346\244bQ\362\362\206\377\306\000\341\337\223\340Y\007,\313\374\220\363\301O\353\234JC\247\217b<\017d\345\336\362\247\263D.\030;=Fy\375\335AgJi(\247\310E\301{\375d\2729A\336\247\363\314\231\354~2{\234\221v\002T\037$\342\263\350\373,\242>\213\222st\233\367)\270C\266\374\214\231/\026\363\357\363\357\001.E\311\262\263\027\231O\201y1\017\003;\203\212N\204\004\"\356\004O\227\224\025C.\352\357vw\345\272\316\336\203\304\013\245\\Q\024\213\022B\003W}\227\235\302\330\332E\251\206\277%\2660n\336P\245\212oj\254\027\271>E\245\250\250\370\363\204\024\225\013\025\361\267\317\246\360q\301n\010]\254\250\027i\376jA\026}h\370\010\311\312;\3769\221s\302\031\3309\005\203\300\001\263d\340>SdE\265J\023\210b\340J\020\307\301\202mN\307PC\365\207\342\334(\253\334)j\271\244\353\n\nS\234\316\271GJ\274#\200W\357\226i\350\271\222^2\263\267D\"\">\2139H\016\307E\203\030Y,\027\2529&\356\035\031i7\364\361\332\374\255\225\215zY.\327i\006QD=/f\244\262\"\212\374~\217\235{\351\251R\225\n|[\032s:;Q\322O\0018\230\006\322\353\351D\252\321\246\370\033A:R\322G\314\263\353\276\037;\3767\345\264N<it\300#6\302\\\204\275\262\266\007\007\360y\363\336\367~\357||f\346E\343\0168<\253\313\225\023\351\366\304c\327\337\214?E\226\"\371\366{\244\340\0239\024\217\364\236\n\265>\213m\0266\374\320\314\016\246\330\020\376\252\031\303?\236\212\354x*\2120\250\201+\242N+\355\023\275v2\203\261\017G!\355Tyj\345?1\354\261\337\021\330E\3678a\317\003\207\037\367\373\373\222\2462p\356C\213\322\376~\261X\303I\216NtHtE\240\221\335\"$\3317B\267\360\000\t\241\373\300w\025x64q\207?c\236\007~6|\300`qF9\201\003\016\377\245d\"\266WR\262\343}\304@\036A\255\325_o\277\203\237\320\327\221\342\002g\346\214\200x\367\226\3342)t""\237\341A\034\320'\224\"\177]\300#\206\004D\235\371\302\020\020g\342\351n\177\274\217\364`\033\240M9\225\375\030\202\341{ra\274\317\357\355\35221\301\177\3279\276\032k\3429\341X;\234\003x\210\240$5g\344Y\327\306|j\206~\"b9v\274\017\213\005\366\271\273\237=\246\247\340mtw\277\273\250\337\347wJZ\216\355\357\327\337\203\2754\323\303`\003\237\200\013u\364#.\002\247\210\230C?\325\261\273\317\233\3712\244\356\204@u\000\013cn=2\225\222SQS\210\036f\275Q\037\333\330\377\275\362=\265\374\367T\371\3775[i\373\035\315\237\006}\373MD\345\301\311\375\340\2409\345\032\312\343\361>\n\301\300$|\304\211-\005\033\214\355c\261%Uu\331\233\344\003{8n\320\361>\376\252C\\f1\327\347\277\370\330@\332\244\024\375\022\305\204\337H\331\354g\271\276\017:\324\331I\342\214\016za\222.\321\265G\247\277^B\313\221u\322 P\257)))\272?eR&\025\375\305\254\270\033\272cE\333\341\313\007\177\232qs\301\352wC\367\355x;<p\260jFM\334\\v/\307\354~{\310^wCw\255\370\277\316\367]\374\332\275\375\235]qBN\242\035~\340>\370\261)5\215\326\354\341z;|\351\340q\343J#\336\036\270|Pi\364\267\007\256\342>|\333D\317W\r\251Q3+V?\t\305\017\226\032\211\306:\255\372\336\274b\372:\240\303\035`w\267\003+|mf\255I[\262+\355\360\260\331o\016\231o\255\032=\014\034<oD\335\320-\246\344\201\321\2107\026\314\376\003\266\350#\310]1\037\232\033\326\035+\341\206\2364\373\231\210{u\324JXo\354\204\333'@\221\320\245\203\2474\306\274j&Hl\322\306j\303\356p\334\271\342N\277<\274\343\276\222]9\347\346\362\355\360-\367\326\224\275ng\235(\337\211a\316Z\2336\364\306\204\355\360`#\344\016\301H\244\323b\343j#\341m\345\261#Q\323\374A\025M\003W\032Q~\341\332\272}#f\242\035\0321\177\266*\355\320M3\352].\374\267\341^B\227\371\213%Y\177:q\207\315\366\250\321\337\210\320\310\nI\374\321\270\333X\367\232\335\310\352\241\304z\216`\305\373v\022\266\ta\031\367\352=\367\3363\367\331\226\273\365K;\364\345\201\344^\206\373ht\305\rG\255\310Q\210t\014\221\022\276\263\2170\343\014\351v\334\177\324Xkhd&\326\341\016bc\216\321\214\373\376\r8\013k\316\267\342\255\205\303\317""\335d\252\035\276H\003\364\306\2670r\244=\010if'\373*,=x\275Q\341\2751\006\264^\275\337\232\177\201Y\250\267\301\233\217\010\"\026\224\215\331_2=f[[\207\233n*\355\2467\274\025i\013\201\021\355\201\301\306g\215\r\177\231'\000\372\234\231\267\266\341\261\241a3l\365[W`\231!H\272\303\264\223\013N\005\210\031\002\262\216\006p!\013\321\266C\013\255\004\301\177\020\326\320\315\273\204\352[\346\214\371\037\366\202\323\357|\345T\270CB\200\324\000`\266N\253\206\032+V\304\002J\027[\353\0013\007-\306\2202\333\234le\017'\334\364o\356o\242+n\273\333\034w]\300\353\316]g\243\031\365a\3377j-\301L\334\233\367\010A_5\212\326\017\344\373/\017\212Lg\352;\370\262!\321M\r\206\014Bf\371\320\007\323%\367\022\342\323\224\010\376\313\316z \360\231b_\233\222\211\215]\244}_m\3347S\226\207\362\021\363\215\225\340\036\272g\336 \207\320#\020\214\310X\007r+\307\037\370l\024~o\261\361\376\266\207\264\247\300\371[\222\035t\007\021\222\326M{\226\351\340\016\214x=t\357\367`\377\315\357[\362a\374\220\005\335Es\310\275\215\260\364&'\251a;bG\251\357\034s~oh\022\324\247\017\266\t\343\227\017\366\032\3530\223\017\366\351\003\t\\\370\310:g=\264R\366\005f\371u\247\320\032k\351\207\321\303\2707\300\375\352\307f\246\025iM\036\312\200^`\360\016c6oV\025\033N\271\261Y(\036\017\310\344A!\225\0232\304\242\025&sD\016%\203\337\263\244\243\360\204\035\345\306\217\376+\334wq\030\343\302C\264\265\213]TO\233R{p\250\361\312\n\321T@5@\257\233\337\302\036\021~\033#\377\264\007o \204\227\0304Yp\314A\213:\010?\372\320\211:O\233\211&\332G\314U;j\317\330\357\233\327\232\022\211\315`AD\306\0360\242\332\t\373\037\315xs\241\205\340\270\326\036\214\264\207\356\270wh\360\214\363\276u\255%\221\240\001\350\014\3372\037[\021\336\365#l\364\355a\177{\370F{H\260.X\025\004x\304\276\017_\336i\376\334bs\327\255\260\375\027\373\016\302\350\022\334\273\355.\201\262\020\007\377t\377)a\3477F\220\037F\036\260\004@\223\000\221,4\333C\337\000\231C7@,C\264\307{\326\r\373\256\235r\316;L\217\ni\301\022\232u\013\2012\362\255%Q\313\264\231\263~\241\271""\200\301a\360\241\265`\367\273\343O\233\021\352|j\315\003q#\024N\354i\016cF\210*q\271\001\005\023\355a\001\260 \244\243\377\221\365\031\300-\333\017\201\300\221Qk\321\276\016\032\030r\3360C\016\217\322hk\037K\325\301%\244\213;2\355\3006cV\332\376\246\331\337\274\325zq\370\204\2403\374\215\371\247\035?\032\0361\027\255k\030\363\207\023=\032\0210\371\006<1mKm!\332\036\275g\355!\377l;\347\234\207\316\257\255\363-\211\300\330m>\357l7?o\335CTw\232.8Z\363f\353\t\000\333i\272\330\274\002\262\\?\032\275o\177\357\3540=G\377\n\245#@\370&\034;\007\227C\030.j\307\246\235\307\315\353p\364\350X{\204\014\r%\206\211\355*\275u\373_+1m\3578\t'\t\346<S\r7\366\003t\374\007\302}\301]{\353\276\375\325\375\025\304\230q3YO+\003Y@\270g\325)\276a\225\376\266p\327\232\201\3630\365\214\373\335\337\233\225\326\245\303\277\271I\032J\023\032\250kb\367\355\307N\304}\010\222}\347\276\333m\307\306\217bq\254<\205\330\033\241\321\032\322\317\013d\335\027Pd\251\225\000m\217\240.\260\323\316\315\346\223V\234\331\202\241\230\245\036\367\373uw=\351&7\335\3157\356\233\255\36603\336\3210\022\324\321\220\207.{\004\214\006\254\376'\346\2108\017Z\375G\204N\263\277=\022\263C\366KF,X{\034\353\316\333{\316\333\346\237\330\360\022\345\262!\324\"\274\364z\353T\233\211\366\315{\226\016\210\257\267o\022\217n\341\206\343\374k\263`G\335\373)/\005\016\021\357\302Q\326\000&\324\2351\236\314\374\306/\020\"\347\234G\000`\204-@\206\277\352\274\242\220\356<\255\264\"G\301\247\241V\3720\002\270a\271*2\3476b\340\261}\305\216\363(\000\201\020\257&\330\266\251\351!\313\022\210\270\002\034\232\"\364\263\216o\314*\324\336D\274l8w@\310^\303\033{\316\226\201\352u\036\236\022y\025\301D<>r\307\032\203CPzB\202\n!\314\271\003g\254\037y7\233\254\325\327\"\001\252\211zO\326U^\351\331[\340\356\\s\275)C\305\227\207\357P\014\035q\253\215\263%\206\211\027x\003\007\3760Ut`\326\363\r\"\237/\206\033\377\211 \317\332\023\316R\363y+\332\212\007\312\213\307f\204*\223\010\027\227Y\322\035$\006\374\021S\307\300}\323\216G\241T\370\236\353\224\030@'""\270l\210\234\230\266o:O\010X\255\371V\345\210wO\330\243\010,^x|\272\nT\307}D\217G\346\005b\314\250u\2358\330+\345\2205\217\006\206\315/\254\244U\361\232\276\2652\3146\244B{\340\213\366\340\265\006\313\014\230\025\265/e\232y\344\203\337\354\257h\027\337\230u\373\034\"9\307\2623\266\350\225\312\222m\3009K\200-K\n\224N\037A0Nn\257\020\034\307L\335\232\000\347\207\2349'\323\214\240\264\001\220\025\370 \004\3302z&A\\4TP\023\340\336\241\333Tr y\371y\3043'\205\357=L0\212\004\372_\207\322a\245\233\017\242v\234\006\022\366\343\3462K\215H\035O\020\346\274\260\306\303\367`\\\020\203\375\263\263\337\334n\261\376g\\\014(\n|=\265\230\370,\255\317\276\340\221\250\375\003\005f\363M\353\330T+\224;\233\373-\226\247\246QhJ\210\333{Do\356\243N\220\336F\220\204\231\037\274\221\025\357\246\355\321\003\200\270`\177\356L6\363\255\002\n\0267\205\224\370{\373\206\200$\377\002\000\332w\362\315\034\330i\230\034p\301\256\360\340d5\023=:aD\370\365V\370\260\377\360\272\273\266N^\217X\243\326;\326\036a&9\032$.\203\367\257\177\022\300P\212\266\007\010\t\204\210\241\306s8\260\302M3\003n[\267\363 D\035^\354\272\211\024z\001\324\303\2579*\003\275\005\275\350\362\300Fg\222\016\022\371\271\343\013\223\325\316a\263\237\303\370\007\346lV\037\016\241|\2549\025_.\355F\277\247\302\212M\350\235\013\334\220w\022\353\236_\371\336Q\342\316\362\002\332\353\371\360\271\345Xqu\2651\335\330\201u\223\346\036\002\205(\211\025\032\310n\327[\177\001\351\260\202\204\325n\276\022\023vp)\344*\367.;\016\322\341\227\032\177\344\225*?1 t\3114!\353%\231\221W\3163\346{;\342\206p\202[#\007~\222\332=k\332\307\215H\343\016\013\333$\302\216\235C'\314\204{\373\021\330QE\226K\241B\013\217\230\363f\215\331:|\003\247\216\337\270\2067\315Q\312/6;e\3571\223\240\270\243-q\205e\024\n\221\2660\352\216>\242\354m\257[\353nh\014\376\017\263\274D\\w\024\366N\231\213\215k\274\362\035l\\\366\206K\235\332\237|\213\256H\343:N|\354t\305\016]\267\371\035\235\230C\010\235\242[T\333\341/\016~il\003\037\335J\237\014\371\031\366,#\375\000>C\215E\363:""\233\224\222\000\233A\203\rp\006jd\315\250\3676\2002\364sV4\366S\211=p\020'\204\247\335\033\364&\200A\354K\344\243:\245`w\352\031\222\310\016\002\235\235L\3228\217<q\230I@U6\240Eei\030\\\357^g\257\021.\0350<L\263\267\036\373\226\344\255\010h\272!J90\306\0021\255\344\035^\306(@\274\035\263\326\240\227\031\226X+\273\014\302\303\237\350\371\213<\220>C\365\236\241\303@\260\274\317\264\276jU\340w\200\373)\262\272\3441\210{\373)ccV\341\243\014\300\340\r@z\232\352\347Qv\2768\317kq^/k\366\r'JeQ\335\016C\333e\324\224(\311\2520\372/\316\273\326\271\326S\252eP\037\241\340\372\347\221\200-\001*H\357\327\274\302x\364\241\373p\016\2343\323z\357\256s1:\371\272y\205*\266?X\241\020\233a\325\330K\024\275\177\320fc\\A\024{qw\364o(o\3165\343\356\017+\207\353\207\250G\311\220y\240j\3446\257\300\022^D\366\262m\317\367W'\314x\325\275\312\213\273\0016\253\367\306\352\203\020\007\217\231Y\226\272\360\360%\253lf\001\305\023\010\307\244\320+J!\025\324\213)z\312\31138\262#v'\371\251\374\362\301>T\374w\235L=^n\344\207::\363\357\341\224\224q\256\320\261\360T\303i\303\322y8D\307&za\361\201\267eL\244\273K\366\"\304\077\077\016\243\304\234@jt7\350\340\347J\273\356n\301-\024i\327\177c\357.\202\373\2564>7\247\254\367\250\344\373\250v\013}F/9\336\363WoC\356\020j\2736{\275\325Gv\rQ\300\204\302\007\027\016j8k\236\3471\347\371\371Z\343\r\302y\235I\3774\246\323\033^!\360\236x\274\217\377`\302\3779\002\357U\370\017\032\276H\257{\376\272X\210UU]\311\361\377\377\201q\374\367EC\234\241\037\222\304\351Z<.>\361\177J\022\037\363_\224\305\265D2\265(n-n.\256\246\307\373\350\337p\360\177\225@o\255\331#\373\365S\233[z\365?\347^\276\374";
    PyObject *data = __Pyx_DecompressString(cstring, 6081, 1);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #else /* compression: none (13679 bytes) */
const char* const bytes = "0DeleteMonitor(%r)Dict[int, int]Dict[str, Any]Error: cannot access screen resourcesError: cannot get refresh rate from screen infoError: crtc Error: failed to add mode %r to output %iError: failed to get randr config ratesError: failed to get randr screen infoError: failed to get randr screen sizesError: failed to retrieve the list of monitorsError: failed to set new screen sizeError: invalid monitor indexes in %sError: only Error: output Error: size not found for Error: this display has no outputsError unpacking Hz (Hz is above maximum value @LList[Tuple[int, int]]List[int]Modeline %ix%i@%s %s %s %s %s %s %s %s %s %sNoneRandRBindings(ScreenChangeNotify=%dTuple[Tuple[int, int], Tuple[int, int]]Tuple[int, int]Warning: XRandR extension is not availableWarning: XRandR extension returned invalid event base: %dWarning: XRandR version check failedWarning: XRandR version %s does not support monitorsWarning: cannot add mode Warning: failed to read output property Warning: invalid EDID data: Warning: invalid vertical refresh rate specified: %iWarning: no CRTC info for Warning: no randr sizes foundXRRCreateMode returned XRRSetCrtcConfig(%#x, %#x, %i, %i, %i, %i, %i, %i, %#x, %i)XRRSetMonitor(%#x, %#x, %#x) output=%i, geometry=%s (%ix%i mm) XRRSetScreenConfigAndRate returned XRRSetScreenConfigAndRate%s=%sXRRSetScreenSize(%#x, %#x, %i, %i, %i, %i): ? :  / .) @ (active_names=%sadd_screen_mode(%s, %i, %i, %i)added modes=%s) added to output adding mode all names=%s and output  are already disabled at %i,%icalculate_mode(%s, %i, %i, %f)calculating mode %rcannot access screen resourcescannot parse EDID:  cannot set screen size to match check_randr_sizes: failed to get randr screen info clock config-timestamp: crtc crtc and output  crtcs crtcs for  data too largedelete=%sdeleting %i: %rdisabledisabling dummy crtc and output dot-clockdpi=enablefailed to remove older modefailed to set crtc config for monitor ) for  for mode %sfound found XRandR extension version  from gcget_current_out""put() screen_resources: crtcs=%s, outputs=%s, modes=%sget_monitor_properties(%#x)get_xrr_screen_sizes()=h-skewh-sync-endh-sync-starth-total has height-mm%i invalid formatinvalid format invalid output number  is is_dummy16() monitor is_dummy16() no modes!is_dummy16() no monitors!is_dummy16() no randr!is_dummy16() only is_dummy16() randr version too old: isenabledkeeping %i: %rmatching monitor index  mm, mode mode-flagsmonitor  monitorsmonitors: %sno XRandR!no mode to matchno-randr-sizesno randr sizes no suitable clocks could be foundnon-desktop not found ( not found, only only ) output= outputs outputs, cannot set  outputs for preferred-modeprimary-output properties from output reading refresh-raterefresh rate for remove_mode(reserved names: %sroot size is now:  %s screen sizesscreen sizes for all screens in mm: %sset_crtc_config(set-screen-sizesetting dummy crtc and output  sizes are supportedsizes found: skipped output property status=%ssubpixel-order to: to ) to output too many new modes (%i), trying to remove the oldest entrytotal screen area is: unable to query screen size rangeusing existing output mode %r (%#x) for %ix%i using format , using name=using screen mode v-sync-endv-sync-startv-totalversion=%swidth-mm with event_base=x11-screen-change-event#xxpra/x11/bindings/randr.pyxABCDEFGHIJKLMNOPQRSTUVWXYZATOMBCastBGRCARDINALCONNECTION_STRCSyncCSyncNegativeCSyncPositiveClockDivideBy2ConnectedDEFAULT_REFRESH_RATEDeleteMonitorDictDisconnectedDoubleClockDoubleScanEDIDGAMMAHEIGHT_MMHSkewPresentHSyncNegativeHSyncPositiveHzINTEGERInterlaceListLoggerMAX_NEW_MODESMODE_FLAGS_STRNonePixelMultiplex__Pyx_PyDict_NextRefRGBROTATIONSROTATION_CONSTRRModeRandRBindingsInstanceRandRBindingsInstance.DeleteMonitorRandRBindingsInstance._set_screen_size.<locals>.genexprRandRBindingsInstance.add_screen_sizeRandRBindingsInstance.check_randr_sizesRandRBindingsInstance.get_all_screen_propertiesRandRBindingsInstance.get_monitor_propertiesRandRBindingsInstance.get_screen_countRandRBindingsI""nstance.get_screen_size_mmRandRBindingsInstance.get_screen_sizes_mmRandRBindingsInstance.get_screen_sizesRandRBindingsInstance.get_screen_sizeRandRBindingsInstance.get_screen_size_rangeRandRBindingsInstance.get_versionRandRBindingsInstance.get_vrefreshRandRBindingsInstance.get_vrefresh_displayRandRBindingsInstance.get_vrefresh_outputsRandRBindingsInstance.get_xrr_screen_sizesRandRBindingsInstance.has_modeRandRBindingsInstance.has_randrRandRBindingsInstance.is_dummy16RandRBindingsInstance.remove_modeRandRBindingsInstance.remove_screen_sizeRandRBindingsInstance.select_crtc_output_changesRandRBindingsInstance.select_screen_changesRandRBindingsInstance.set_crtc_configRandRBindingsInstance.set_output_int_propertyRandRBindingsInstance.set_screen_sizeRandRBindingsInstance.xrr_set_screen_sizeRandRBindingsSUBPIXEL_STRSUSPENDEDScreenChangeNotifyTIMESTAMPSTupleUnknownVBGRVFBVRGBVSyncNegativeVSyncPositiveWIDTH_MMXPRA_RANDR_GAMMAXPRA_RANDR_MAX_NEW_MODESXPRA_RANDR_TIMESTAMPSXSyncactive_namesadd_screen_modeadd_screen_sizeall_namesappend_asdictasyncio.coroutinesatomautomaticbasenamebindingsblueboolcalcsizecheck_randr_sizescline_in_tracebackclonescloseconfigconfig_timestampconnectioncontext_checkcountcrtccrtc_infocrtcscsvddatadecode_strdeletedictdisplaydpi96dpidpiinfodpixdpiyencodeenvboolenvinterrorerror_baseevent_baseexc_infoextext_charsfirst_time__func__gammagenexprgeometrygetget_all_screen_propertiesget_atom_nameget_crtc_info.<locals>.genexprget_current_outputget_mode_info.<locals>.genexprget_monitor_propertiesget_output_info.<locals>.genexprget_output_properties.<locals>.genexprget_rotationget_rotationsget_screen_countget_screen_sizeget_screen_size_mmget_screen_size_rangeget_screen_sizesget_screen_sizes_mmget_versionget_vrefreshget_vrefresh_displayget_vrefresh_outputsget_xrr_screen_sizesgreenhhas_modehas_randrheighthmmhzhzstriidindexinfoinit_xrandr_eventsint_is_coroutineis_dummy16itemsjkkeyslatin1logm__main__maskmatch_modemaxmaxHeightmaxWidthmaxxmaxymheightmiminminHeightminWidth""mmhmmwmodemode_infomode_namemodes__module__monitormonitor_defsmonitor_names_monitor_properties.<locals>.genexprmonitorsmonotonicmwidthnname__name__name_atomnew_modesnextnmonitorsnonenoutputnpossiblenum_sizesooutputoutput_infooutput_namesoutputspackparse_edidposinfoprettify_plug_nameprimarypropprop_namepropertiesptypepyedid__pyx_capi____pyx_vtable____qualname__rrandrrateratesredremove_moderemove_screen_sizerenumreturnrootroot_hroot_wrotationrotation_introtationsroundrrorscrstriprvalscreen_hscreen_wselect_crtc_output_changesselect_screen_changesselfsendseqset_crtc_configset_crtc_config.<locals>.dpi96__set_name__set_output_int_propertyset_screen_sizesetdefaultsize_indexsizesstatusstrstructsubpixel_order__test__ththrowtimetimestamptwtypingunknownunpackvvaluevaluesversionvoutputsvrefreshwwarnwidthwindowwmmxx11xpra.commonxpra.logxpra.util.envxpra.util.screenxpra.util.str_fnxpra.x11.bindings.randrxrr_set_screen_sizeyDisplay *(void)\000get_displayPyObject *(Display *)\000get_all_screen_propertiesPyObject *(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level)\000PyObject*(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char)\000int(PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs)\000int(PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name)\000int(PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs)\000int(PyObject *obj, PyTypeObject *type, const char *name, int exact)\000void(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause)\000void(const char* function_name, PyObject *kwds)\000__Pyx__Import\000__Py""x_PyUnicode_Join\000__Pyx_ParseKeywordsTuple\000__Pyx_ParseKeywordDictToDict\000__Pyx_ParseKeywordDict\000__Pyx__ArgTypeTest\000__Pyx_Raise\000__Pyx_RejectKeywords\2401\320\004\"\240!\330\010\017\210|\2301\230D\240\001\320\004+\2501\330\010\014\210N\230!\2301\330\010\017\320\017(\250\001\250\024\250Q\320\004#\2401\360\006\000\t\036\320\035/\250q\260\004\260A\330\010.\320.>\270a\270t\300:\310Q\330\010\013\2106\220\022\2201\330\014\017\210q\220\001\330\014\023\2201\330\010\035\230Q\330\010\026\220a\220x\230q\240\001\330\010\013\2101\210H\220A\220Q\330\010\017\210z\230\022\2301\320\004\"\240!\330\010\013\2101\320\014\"\240!\330\010\035\320\035/\250q\260\004\260A\330\010\036\230d\240,\250a\250q\330\010\030\230\001\230\024\230Z\240x\250q\330\010\014\210F\220!\320\004\033\2301\330\010\017\210t\2201\220D\230\001\210\001\330\014\023\2205\230\001\230\022\2302\230U\240\"\240A\320\0048\270\001\330\010\017\210t\320\023$\240A\240W\250A\320\000 \240\001\330\004\013\2109\220D\230\001\230\023\230A\240A\320\004,\250A\330\010\030\320\0301\260\022\3203J\310\"\320Le\320eg\320gh\330\010\033\320\033-\250Q\250d\260!\330\010\026\220a\220t\230:\240V\2501\320\004$\240A\330\010\020\220\004\320\024(\250\001\330\010\014\210E\220\023\220A\330\010\013\2101\320\0146\260a\330\010\014\210C\210u\220A\330\014\022\220!\330\014\022\220!\330\010\017\210t\2201\320\000\034\230A\330\004\034\230K\240q\330\004\032\230!\330\004\032\230!\330\004\007\200t\320\013\034\230A\230Y\240a\240|\2601\260A\330\010\013\2105\220\001\220\021\330\010\017\210q\330\004\007\200{\220#\220Q\330\010\013\2105\220\001\320\021N\310a\330\010\017\210q\340\004\"\240+\250R\250q\330\004\022\220!\320\023'\320'=\320=X\320XY\330\004\016\210a\320\017#\2401\330\004\007\200q\320\010!\240\021\340\004\013\2101\320\004\034\230A\330\010\014\210N\230!\2301\340\010\013\2104\210t\2201\330\014\017\210q\220\001\330\014\023\2201\330\010\013\2104\210x\220r\230\023\230A\330\014\017\210q\320\0206\260a\260t\2701\330\014\023\2201\330\010\035\320\035/\250q\260""\004\260A\330\010'\320'C\3001\300D\310\n\320RS\330\010\t\330\014\017\210s\220&\230\001\230\021\330\020\023\2201\320\024(\250\001\250\023\250A\330\020\027\220q\330\014\017\210s\220(\230!\2301\330\020\023\2201\320\024(\250\001\250\023\250A\330\020\027\220q\330\014\017\210s\220&\230\002\230!\330\020\023\2201\220A\330\020\027\220q\340\014\"\240!\2401\340\010(\250\016\260a\260t\270:\300X\310V\320ST\320TU\330\010\t\330\014\017\210t\2201\330\020\023\2201\220A\330\020\027\220q\330\014\020\220\005\220U\230!\2301\330\020\023\2208\2301\230B\230h\240b\250\001\330\024\030\230\010\240\001\240\022\2401\330\024\027\220q\320\030/\250q\260\007\260q\270\001\330\024\033\2301\340\014\033\2301\230A\330\010\017\210q\320\004D\300A\360\006\000\t\020\210x\220s\230#\230Q\330\010\033\2304\230}\250D\260\001\260\026\260q\330\010\013\2105\220\004\220D\230\014\240A\240Q\330\014\020\220\004\220M\240\021\240!\320\004E\300Q\330\010\014\210N\230!\2301\340\010\035\320\035/\250q\260\004\260A\330\010\013\2101\320\014:\270,\300d\310*\320T\\\320\\_\320_b\320bg\320gh\330\010\030\230\001\230\024\230Z\240x\250s\260#\260U\270!\330\010\014\210F\220!\320\000$\240H\250A\330\004\007\200q\320\010'\240q\330\004\026\220m\240<\250q\330\004\016\210m\2301\230A\330\004\007\200q\210\016\220a\330\004\007\200x\210s\220#\220Q\330\010\013\2105\220\001\320\021I\310\021\330\010\017\210q\330\004\013\320\013\035\230Q\230a\320\004,\250I\260Q\330\010\014\210N\230!\2301\330\010\013\2101\320\014\036\230a\230q\330\010\t\360\006\000\t\023\220+\230S\240\001\330\010\014\210E\220\034\230W\240A\330\014\017\210s\220'\230\031\240!\2401\240A\330\014\032\230!\230:\240Q\240a\240q\330\014\032\230!\230:\240Q\240a\240q\330\010\013\2101\320\014$\240A\240Z\250q\260\001\330\010\013\2104\210t\2209\230A\230Z\240q\330\014\020\320\020 \240\001\240\032\250:\260Q\330\010\014\320\014\034\230A\230Z\240q\330\010\014\320\014 \240\001\240\032\250:\260U\270!\270;\300e\3101\310A\330\010\020\220\t\230\024\320\035-\250Q\330\010\013\2101\320\014 \240\001\240\030""\250\021\250!\330\010\020\220\003\2201\220A\330\010\035\320\035/\250q\260\004\260A\330\010'\320'C\3001\300D\310\n\320RS\340\010\013\2103\210b\220\001\330\014\017\210v\220Q\220a\330\014\023\2201\330\010\013\2103\210a\210|\2305\240\003\2402\240S\250\007\250s\260#\260Q\260l\300%\300s\310!\3101\330\014\017\210v\220Q\320\026>\270c\300\021\300,\310e\320ST\330\014\023\2201\330\010\013\2103\210f\220A\220Q\330\014\017\210v\220Q\220n\240A\240S\320(:\270!\2701\330\014\023\2201\330\010\013\2103\210h\220a\220q\330\014\017\210v\220Q\220n\240A\240S\320(>\270a\270q\330\014\023\2201\340\010'\240q\360\006\000\t'\240a\340\010*\250!\360\006\000\t\023\220!\360\010\000\t\030\220q\330\010\024\220A\330\010\t\330\014\020\220\005\220U\230!\2303\230a\330\020\024\220L\240\004\240A\240S\250\001\330\020\027\220s\230&\240\001\240\021\330\020\027\220s\230(\240!\2401\330\020\031\230\023\230H\240A\240Q\330\020\023\2201\220B\220a\220y\240\001\320!2\260!\2609\270A\270Q\330\020\034\230N\250!\2504\250z\270\025\270a\330\020\023\2204\220q\330\024\027\220v\230Q\230n\250A\250^\2701\270D\300\001\330\024\025\330\020\021\330\024\"\320\"2\260!\2604\260z\300\025\300a\330\024\027\220t\2301\330\030\033\2306\240\021\320\"2\260!\260>\300\021\300&\310\001\330\030\031\330\024 \240\007\240q\250\001\250\021\250+\260U\270\"\270K\300q\330\024\027\220y\240\010\250\002\250\"\250D\260\013\270;\300b\320HX\320X\\\320\\`\320`a\360\006\000\031\034\2301\320\034.\250a\250q\330\030\031\330\024\036\230a\330\024\033\2301\330\024\037\230q\330\024\031\230\021\330\024\027\220s\230'\240\031\250#\250S\260\006\260a\330\024\027\220q\330\030\033\2301\230D\240\001\240\033\250A\330\034&\240a\330\030\033\2303\230g\240Y\250a\250q\260\001\330\030#\2401\240D\250\001\320)9\270\021\330\030\033\2309\240C\240q\330\034'\240q\330\030\033\2309\240B\240a\330\034!\240\021\340\034!\240\031\250\"\250A\330\030 \240\003\2401\240A\330\030\033\2305\240\005\240Q\240e\2502\250Q\330\034$\240E\250\027\260\001\260\024\260W\270A\270Q\330\030$\240B\240a\240w\250a\250y""\270\001\330\030\033\2301\320\0343\2601\330\030%\240T\250\037\270\001\270\033\300G\3108\320ST\330\030\037\230|\2501\340\030\034\230E\240\025\240a\240{\260!\340\034 \240\005\240U\250!\2503\250a\330 !\330$'\240v\250Q\250b\260\003\2602\260[\300\006\300a\300s\310!\330$'\240v\250Q\250b\260\006\260b\270\n\300'\310\021\330$'\240v\250Q\250b\260\007\260r\270\032\3008\3101\330$'\240v\250Q\250b\260\t\270\022\270:\300Q\340$+\250;\260f\270A\270Q\330$0\260\001\260\021\260#\260V\2701\270B\270a\330$'\240q\250\001\330(3\2606\270\027\300\001\330$%\330\034\037\230q\330 !\330\030\033\2304\230q\340\034 \240\005\240U\250!\2503\250a\330 !\330$'\240v\250Q\250b\260\006\260b\270\n\300'\310\021\330$'\240v\250Q\250b\260\007\260r\270\032\3008\3101\330$'\240v\250Q\250b\260\t\270\022\270:\300Q\340$+\2503\250f\260A\260R\260q\330$0\260\001\260\021\260#\260V\2701\270B\270a\330$'\240q\320(<\270A\270^\3101\310D\320PZ\320Z[\320[b\320bc\320cd\330$%\330\034\037\230t\2401\340 '\240y\260\004\260A\260[\300\001\330 #\2404\240q\330$+\2504\320/?\270q\300\013\3107\320RZ\320Z[\330$'\240t\2501\330(+\2506\260\021\3202_\320_j\320jk\330()\340(1\260\021\260-\270q\330\034#\2404\240r\250\023\250G\2601\260G\2701\270H\300A\300Q\330\034,\250A\250T\260\032\2708\3001\330\034\037\230q\240\007\240q\250\016\260a\260t\320;Q\320QR\320RV\320VW\320WX\330\030'\240q\250\001\340\030\"\240!\340\024#\2401\240D\250\001\250\034\260Q\330\024\037\230~\250T\260\021\260.\300\001\340\024\027\220q\230\001\330\034(\250\004\250J\260l\300%\300q\330\034)\250\023\250C\250v\260Z\270|\3101\310H\320TU\330\024\030\320\030(\250\001\250\024\250Z\260u\270A\330\032'\240s\250#\250Q\330\032$\240A\240X\250Q\330\024\027\220q\330\030\036\230l\250!\320+S\320ST\320TU\330\024\032\230!\2304\230q\240\014\250C\250s\260%\260q\270\001\330\024\032\230!\2304\230q\240\r\250S\260\003\2605\270\001\270\021\330\024\030\320\0300\260\001\260\023\260L\300\001\330\024\030\320\0300\260\001\260\023\260M\300\021\340\024\030\320\0300\260\001\260\023\260M\300\024\300T\310\021\310!""\330\024\027\220u\230B\230b\240\003\2406\250\022\2501\330\030\033\2305\240\001\320!C\3001\300A\340\030\"\240!\330\030\033\2302\230S\240\001\330\034&\240l\260#\260S\270\001\330\030\"\240!\330\030\037\230u\240A\240V\2502\250U\260\"\260A\330\030\037\230u\240A\240W\250B\250e\2602\260Q\330\030\033\2303\230a\230t\2401\240E\250\021\250!\330\034\"\240%\240r\250\024\250Q\250e\2601\260A\330\034&\240f\250A\250Q\340\034&\240f\250A\250V\2601\260A\330\030\033\2305\240\001\320!A\300\021\300!\330\030\033\2305\240\001\240\023\240A\240W\250A\250X\260Q\260g\270Q\270e\3001\300J\310j\320XY\340\024\027\220q\330\030)\250\021\250!\330\030&\240a\330\024\027\220q\330\030'\240q\250\001\330\030$\240A\330\014\020\220\006\220a\360\006\000\r\030\220~\240Q\240d\250*\260H\270F\300!\3001\330\014\017\210t\2201\330\020\023\2206\230\021\230!\330\020\021\330\014\020\220\006\220e\2301\230A\330\020\027\220t\230>\250\021\250(\260!\2603\260a\330\020\023\2204\220x\230q\240\003\2401\330\024\027\220q\320\030+\2504\250q\330\024$\240A\240T\250\032\2608\2708\3001\300C\300q\340\024\027\220q\320\030*\250$\250a\330\014\033\2301\230A\360\006\000\r\030\220~\240Q\240d\250*\260H\270F\300!\3001\330\014\017\210t\2201\330\020\023\2206\230\021\230!\330\020\021\330\014\034\230A\330\014\020\220\006\220e\2301\230A\330\020\027\220t\230>\250\021\250(\260!\2603\260a\330\020\023\2205\230\007\230q\330\024!\240\027\250\001\250\021\330\014\017\210q\320\020 \240\001\340\014\030\230\r\240R\240q\330\014\017\210q\320\020&\240c\250\021\250!\330\014\033\2301\330\014\r\330\020\025\220Q\330\020\034\230A\330\020\026\220a\330\020\024\220C\220v\230\\\250\026\250q\330\024\037\230y\250\003\2503\250g\260U\270!\2701\330\024\033\320\033-\250Q\250a\250t\2601\260H\270A\330\024\027\220t\2305\240\003\2405\250\003\2501\330\030\037\230q\330\024\032\230%\230s\240*\250D\260\004\260B\260c\270\021\270!\330\030\036\230i\240q\250\004\250C\250q\260\001\330\030\037\230q\330\030\037\230r\240\021\240*\250A\330\024\035\230W\240A\240Q\330\024 \240\007\240q\250\001""\330\024\027\220q\320\0301\260\021\260'\270\021\270$\270a\270\177\310a\310q\330\024\027\220s\230'\240\031\250!\2501\250A\330\024\032\230!\2301\230I\240S\250\001\330\024\033\2308\2404\240|\2601\260A\330\024\033\230;\240a\240t\2501\250K\260w\270b\300\001\330\024\033\230=\250\001\330\024\033\2305\240\001\330\024\033\2305\240\001\330\024\033\2309\240A\330\024\033\230:\240Q\330\024\033\230:\240Q\240d\250!\250<\260u\270A\270W\300A\330\024\033\230;\240a\240t\2501\250M\270\025\270a\270w\300a\330\024\033\2303\230h\240a\240s\250'\260\021\260#\3205S\320ST\320TU\330\024\035\230S\240\010\250\001\250\021\330\024\033\230;\240a\240q\330\024\033\230;\240a\330\024\027\220q\230\001\330\030$\240D\250\n\260,\270h\300l\320RS\320S\\\320\\]\330\031 \240\004\240G\2504\250w\260h\270g\300Q\330\030\037\230y\250\007\250q\330\024\027\220u\230A\230Z\240q\250\007\250q\260\010\270\001\270\027\300\010\310\001\310\027\320PQ\330\024!\240\021\240$\240j\260\010\270\001\270\021\330\024\032\230!\340\020\037\230q\240\001\340\014\027\220~\240Q\240d\250*\260H\270F\300!\3001\330\014\017\210t\2201\330\020\023\2206\230\021\230!\330\020\021\330\014\030\230\001\330\014\025\220Q\330\014\r\330\020\024\220F\230%\230q\240\001\330\024\033\2304\230~\250Q\250h\260a\260s\270!\330\024\035\230W\240A\240Q\330\024\027\220u\230G\2401\330\030\036\230g\240Q\240a\340\020\037\230q\240\001\330\014\020\220\006\220a\330\014\017\210q\320\020#\2401\330\014\017\210q\320\020 \240\001\330\014\017\210q\220\r\230Q\330\014\020\220\010\230\001\330\020\027\220t\230<\240q\250\001\330\020 \240\001\240\024\240Z\250x\260q\330\014\017\210q\220\r\230T\320!;\2701\330\014\020\220\006\220a\340\014\"\240!\2401\320\004(\250\001\330\010\014\210N\230!\2301\330\010\017\320\017!\240\021\240$\240a\320\004:\270!\330\010\014\210N\230!\2301\330\010\035\320\035/\250q\260\004\260A\330\010'\320'C\3001\300D\310\n\320RS\330\010\t\330\014\020\220\005\220U\230!\2303\230a\330\020\023\2203\220f\230A\230R\230v\240R\240r\250\024\250S\260\006\260a\260r\270\027\300\002\300!""\330\024\033\2301\330\014\023\2201\340\014\"\240!\2401\320\004*\250!\330\010\014\210N\230!\2301\330\010\037\230t\320#6\260a\330\010\013\2101\210N\230!\230>\250\021\250!\330\010\013\2105\220\004\220A\330\014\037\230q\240\004\240J\250h\260a\330\014\032\230!\2304\230z\250\021\320\004=\320=P\320PQ\330\010\014\210N\230!\2301\330\010\035\320\035/\250q\260\004\260A\330\010'\320'C\3001\300D\310\n\320RS\330\010\013\2103\210b\220\001\330\014\017\210v\220Q\220a\330\014\023\2201\330\010\013\2106\220\021\220\"\220C\220v\230R\230s\240!\330\014\022\220*\230A\320\0355\260Q\260n\300A\300S\310\001\330\010\034\230C\230x\240q\250\001\330\010\031\230\024\230\\\250\021\250!\330\010\032\230$\230l\250!\2501\330\010\017\210v\220U\230!\2306\240\021\330\010\037\230q\240\004\240J\250e\2606\270\021\330 $\320$5\260V\2701\250Q\240Q\320\004%\240Q\330\010\036\230l\250!\2504\250q\340\010\034\230A\330\010\014\210E\220\025\220a\220q\330\014\020\220\017\230q\240\004\240J\250a\330\014\020\320\020 \240\001\240\024\240Z\250q\330\014\021\220\027\230\002\230#\230Q\330\010\017\210q\320\004\035\230Q\330\010\017\210t\2201\320\004T\320Tm\320mn\330\010\r\210Y\220b\230\001\330\010\020\220\003\2201\220A\330\010\013\2105\220\005\220Q\220e\2302\230Q\330\014\024\220E\230\027\240\001\240\024\240W\250A\250Q\330\010\017\210r\220\021\220#\220Q\220d\230!\330\010\017\210t\320\023#\2401\240F\250#\250S\260\001\360\006\000\t\014\2101\330\014\025\220T\320\031,\250A\330\014\017\210q\220\016\230a\230y\250\001\250\024\320-=\270Q\270f\300A\330\014\034\230A\230T\240\032\2508\2601\330\010\017\210q\260\001\250a\320\004\036\230a\330\010\023\2204\320\027,\250A\330\010\013\2101\330\014\023\2203\220a\220x\230w\240a\330\010\017\210t\320\023(\250\001\320\004&\240a\330\010\014\210D\320\020&\240a\330\010\013\2101\320\014%\240Q\240a\330\010\017\210q\320\004&\240a\330\010\035\320\035/\250q\260\004\260A\330\010*\250!\330\010&\240a\330\010&\240a\330\010\020\220\001\330\010'\320'C\3001\300D\310\n\320RS\330\010\013\2103\210b\220\001\330\014\017""\210v\220Q\220a\330\014\023\2201\330\010\t\330\014\020\220\010\230\005\230Q\230c\240\021\330\020\034\230N\250!\2504\250z\270\025\270c\300\026\300q\310\001\330\020\023\2209\230B\230a\330\024\027\220u\230A\320\0359\270\021\270!\330\024\025\330\020\021\340\024\030\230\005\230U\240!\2403\240a\330\030$\240A\240S\250\006\250a\250q\330\030\033\2309\240C\240r\250\031\260!\330\034\037\230y\250\010\260\004\260I\270Q\330 '\240u\250A\250Y\260j\300\003\3009\310H\320TV\320V_\320_`\340 /\250q\330 $\240E\250\025\250a\250y\270\001\330$2\3202B\300!\3004\300z\320QV\320V_\320_g\320gh\320hi\330$'\240{\260\"\260A\330(4\260G\2701\270J\300a\300{\320RS\330(9\270\021\270!\330 #\2401\320$7\260q\270\003\2701\320<M\310Q\310a\330 %\240Q\240h\250a\330\034\035\340\024#\2401\240A\340\014\"\240!\2401\330\010\017\210q\320\004&\240a\330\010\035\320\035/\250q\260\004\260A\330\010.\320.>\270a\270t\300:\310Q\330\010\013\2106\220\022\2201\330\014\017\210v\220Q\220a\330\014\023\2201\330\010\t\330\014\023\320\023'\240q\250\001\340\014#\2401\240A\320\004\"\240!\330\010\036\230l\250!\2504\250q\340\010\034\230A\330\010\014\210E\220\025\220a\220q\330\014\020\220\r\230Q\230d\240*\250A\330\014\020\220\016\230a\230t\240:\250Q\330\014\021\220\027\230\002\230#\230Q\330\010\017\210q\240q\250q\320\004!\240\021\330\010\035\320\035/\250q\260\004\260A\330\010&\240a\330\010'\320'C\3001\300D\310\n\320RS\330\010\013\2104\210q\330\014\022\220,\230a\230q\330\010\017\210w\220a\330\010\t\330\014\020\220\010\230\005\230Q\230c\240\021\330\020\034\230N\250!\2504\250z\270\025\270c\300\026\300q\310\001\330\020\023\2209\230B\230a\330\024\027\220u\230A\320\0359\270\021\270!\330\024\025\330\020\023\2209\230I\240S\250\001\330\024\025\330\020\021\330\024\036\230a\230v\240Y\250c\260\022\2609\270A\330\024\036\230a\230v\240Y\250c\260\022\2609\270A\340\024#\2401\240A\340\014\"\240!\2401\330\010\017\210v\220Q\320\004'\240q\330\010\030\230\001\330\010\033\320\033-\250Q\250d\260!\330\010\026\220a\220t\230:\240V\2501\320\004'\240q\330\010\035""\320\035/\250q\260\004\260A\340\010\035\320\0352\260!\2604\260z\300\030\310\021\310*\320TU\320U`\320`a\320ak\320kl\320lm\330\010\013\2107\220#\220Q\330\014\022\220,\230a\230q\330\010\017\210q\220\n\230-\240z\260\021\320\000\027\220q\330\004\005\330\004\007\200z\220\023\220A\330\010\024\320\024)\250\021\330\004\013\2101\320\000!\240\021\330\004\020\220\001\330\004\010\210\007\210x\220y\240\006\240a\330\010\013\2106\220\022\2201\330\014\025\220W\230A\230Q\330\004\013\2101@%svoid (PyObject *)\000import_checkvoid (int, PyObject *, PyObject *, PyObject *)\000void (unsigned int, __pyx_t_4xpra_3x11_8bindings_6events_PARSE_XEVENT)\000add_event_type\000add_parserBHL";
    PyObject *data = NULL;
    CYTHON_UNUSED_VAR(__Pyx_DecompressString);
    #endif
    PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
    Py_ssize_t pos = 0;
    for (int i = 0; i < 480; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
      if (likely(string) && i >= 175) PyUnicode_InternInPlace(&string);
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
      stringtab[i] = string;
      pos += bytes_length;
    }
    for (int i = 480; i < 530; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
      stringtab[i] = string;
      pos += bytes_length;
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    Py_XDECREF(data);
    for (Py_ssize_t i = 0; i < 530; i++) {
      if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    #if CYTHON_IMMORTAL_CONSTANTS
    {
      PyObject **table = stringtab + 480;
      for (Py_ssize_t i=0; i<50; ++i) {
        #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
        #if PY_VERSION_HEX < 0x030E0000
        if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
        #else
        if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
        #endif
        {
          Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
        }
        #else
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
        #endif
      }
    }
    #endif
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab;
    double const c_constants[] = {25.4,60.0};
    for (int i = 0; i < 2; i++) {
      numbertab[i] = PyFloat_FromDouble(c_constants[i]);
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 2;
    int8_t const cint_constants_1[] = {0,1,2,3,6,32,90,96};
    int16_t const cint_constants_2[] = {180,270,768,1000,1024};
    int64_t const cint_constants_8[] = {4294967295LL,30000000000LL};
    for (int i = 0; i < 15; i++) {
      numbertab[i] = PyLong_FromLongLong((i < 8 ? cint_constants_1[i - 0] : (i < 13 ? cint_constants_2[i - 8] : cint_constants_8[i - 13])));
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_number_tab;
    for (Py_ssize_t i=0; i<17; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
typedef struct {
    unsigned int argcount : 3;
    unsigned int num_posonly_args : 1;
    unsigned int num_kwonly_args : 1;
    unsigned int nlocals : 6;
    unsigned int flags : 10;
    unsigned int first_line : 11;
} __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 346};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 371};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i_2};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__12, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 448};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 518};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i_2};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 534};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i_2};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 535};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i_2};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 536};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i_2};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 574};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_j};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 713};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1094};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_dpi96, __pyx_mstate->__pyx_kp_b_iso88591_5_2U_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 121};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_rotation, __pyx_mstate->__pyx_kp_b_iso88591_9D_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 125};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_rotations, __pyx_mstate->__pyx_n_u_renum, __pyx_mstate->__pyx_n_u_rval};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_rotations, __pyx_mstate->__pyx_kp_b_iso88591_xy_a_6_1_WAQ_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 578};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_display, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_version};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_monitor_properties, __pyx_mstate->__pyx_kp_b_iso88591_HA_q_q_m_q_m1A_q_a_xs_Q_5_I_q_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 618};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_version, __pyx_mstate->__pyx_kp_b_iso88591_Q_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 621};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_config, __pyx_mstate->__pyx_n_u_num_sizes};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_check_randr_sizes, __pyx_mstate->__pyx_kp_b_iso88591_1_q_A_at_Q_6_1_q_1_Q_axq_1HAQ_z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 634};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_has_randr, __pyx_mstate->__pyx_kp_b_iso88591_1_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 637};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mask, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_select_screen_changes, __pyx_mstate->__pyx_kp_b_iso88591_q_Qd_at_V1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 642};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mask, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_select_crtc_output_changes, __pyx_mstate->__pyx_kp_b_iso88591_A_1_3J_Leeggh_Qd_at_V1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 659};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_xrr_screen_sizes_2, __pyx_mstate->__pyx_kp_b_iso88591_a_D_a_1_Qa_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 734};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_screen_count, __pyx_mstate->__pyx_kp_b_iso88591_1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 737};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_sizes, __pyx_mstate->__pyx_n_u_tw, __pyx_mstate->__pyx_n_u_th, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_screen_size_mm, __pyx_mstate->__pyx_kp_b_iso88591_A_E_A_1_6a_CuA_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 746};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_i_2, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_sizes};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_screen_sizes_mm, __pyx_mstate->__pyx_kp_b_iso88591_Q_l_4q_A_E_aq_q_Ja_Zq_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 756};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_i_2, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_sizes};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_screen_sizes, __pyx_mstate->__pyx_kp_b_iso88591_l_4q_A_E_aq_Qd_A_at_Q_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 766};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_crtc_info, __pyx_mstate->__pyx_n_u_rsc, __pyx_mstate->__pyx_n_u_maxx, __pyx_mstate->__pyx_n_u_maxy, __pyx_mstate->__pyx_n_u_crtc_2};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_screen_size, __pyx_mstate->__pyx_kp_b_iso88591_q_A_a_C1D_RS_4q_aq_wa_Qc_N_4z_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 790};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_minWidth, __pyx_mstate->__pyx_n_u_minHeight, __pyx_mstate->__pyx_n_u_maxWidth, __pyx_mstate->__pyx_n_u_maxHeight, __pyx_mstate->__pyx_n_u_status};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_screen_size_range, __pyx_mstate->__pyx_kp_b_iso88591_q_q_A_2_4z_TUU_aakkllm_7_Q_aq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 798};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_voutputs};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_vrefresh, __pyx_mstate->__pyx_kp_b_iso88591_a_4_A_1_3axwa_t, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 804};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_config};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_vrefresh_display, __pyx_mstate->__pyx_kp_b_iso88591_a_q_A_at_Q_6_1_vQa_1_q_1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 815};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_output_info, __pyx_mstate->__pyx_n_u_crtc_info, __pyx_mstate->__pyx_n_u_mode_info, __pyx_mstate->__pyx_n_u_rates, __pyx_mstate->__pyx_n_u_rsc, __pyx_mstate->__pyx_n_u_crtc_2, __pyx_mstate->__pyx_n_u_i_2, __pyx_mstate->__pyx_n_u_rate, __pyx_mstate->__pyx_n_u_output_names, __pyx_mstate->__pyx_n_u_o};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_vrefresh_outputs, __pyx_mstate->__pyx_kp_b_iso88591_a_q_A_a_a_C1D_RS_3b_vQa_1_Qc_N, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 854};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_width, __pyx_mstate->__pyx_n_u_height};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_set_screen_size_2, __pyx_mstate->__pyx_kp_b_iso88591_8_t_AWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 857};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_vrefresh, __pyx_mstate->__pyx_n_u_hz, __pyx_mstate->__pyx_n_u_hzstr, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_mode, __pyx_mstate->__pyx_n_u_output_2};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_add_screen_size, __pyx_mstate->__pyx_kp_b_iso88591_TTmmn_Yb_1A_5_Qe2Q_E_WAQ_r_Qd_t, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 965};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_mode};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_remove_screen_size, __pyx_mstate->__pyx_kp_b_iso88591_DA_xs_Q_4_D_q_5_D_AQ_M, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 973};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mode, __pyx_mstate->__pyx_n_u_mode, __pyx_mstate->__pyx_n_u_output_2};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_remove_mode, __pyx_mstate->__pyx_kp_b_iso88591_N_1_t_6a_1N_5_A_q_Jha_4z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 997};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_wmm, __pyx_mstate->__pyx_n_u_hmm, __pyx_mstate->__pyx_n_u_window};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_xrr_set_screen_size, __pyx_mstate->__pyx_kp_b_iso88591_EQ_N_1_q_A_1_d_T___bbggh_Zxs_U, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1010};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_rsc, __pyx_mstate->__pyx_n_u_nmonitors, __pyx_mstate->__pyx_n_u_monitors, __pyx_mstate->__pyx_n_u_i_2, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_is_dummy16, __pyx_mstate->__pyx_kp_b_iso88591_A_N_1_4t1_q_1_4xr_A_q_6at1_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1048};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_monitor_properties, __pyx_mstate->__pyx_kp_b_iso88591_N_1_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1052};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_get_all_screen_properties, __pyx_mstate->__pyx_kp_b_iso88591_1_N_1_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1056};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_output_2, __pyx_mstate->__pyx_n_u_prop_name, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_rsc, __pyx_mstate->__pyx_n_u_rro, __pyx_mstate->__pyx_n_u_prop, __pyx_mstate->__pyx_n_u_ptype, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_set_output_int_property, __pyx_mstate->__pyx_kp_b_iso88591_PPQ_N_1_q_A_C1D_RS_3b_vQa_1_6_C, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1072};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_rsc, __pyx_mstate->__pyx_n_u_i_2};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_has_mode, __pyx_mstate->__pyx_kp_b_iso88591_N_1_q_A_C1D_RS_U_3a_3fARvRr_S_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1084};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_name_atom};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_DeleteMonitor, __pyx_mstate->__pyx_kp_b_iso88591_1_q_A_d_aq_Zxq_F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 57, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1091};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_monitor_defs, __pyx_mstate->__pyx_n_u_dpi96, __pyx_mstate->__pyx_n_u_dpi96, __pyx_mstate->__pyx_n_u_screen_w, __pyx_mstate->__pyx_n_u_screen_h, __pyx_mstate->__pyx_n_u_m, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y, __pyx_mstate->__pyx_n_u_width, __pyx_mstate->__pyx_n_u_height, __pyx_mstate->__pyx_n_u_root_w, __pyx_mstate->__pyx_n_u_root_h, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_window, __pyx_mstate->__pyx_n_u_rsc, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_mode, __pyx_mstate->__pyx_n_u_match_mode, __pyx_mstate->__pyx_n_u_nmonitors, __pyx_mstate->__pyx_n_u_crtc_2, __pyx_mstate->__pyx_n_u_crtc_info, __pyx_mstate->__pyx_n_u_output_2, __pyx_mstate->__pyx_n_u_output_info, __pyx_mstate->__pyx_n_u_monitors, __pyx_mstate->__pyx_n_u_monitor_2, __pyx_mstate->__pyx_n_u_primary, __pyx_mstate->__pyx_n_u_output_names, __pyx_mstate->__pyx_n_u_new_modes, __pyx_mstate->__pyx_n_u_i_2, __pyx_mstate->__pyx_n_u_noutput, __pyx_mstate->__pyx_n_u_vrefresh, __pyx_mstate->__pyx_n_u_hz, __pyx_mstate->__pyx_n_u_hzstr, __pyx_mstate->__pyx_n_u_mode_name, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_rotation_int, __pyx_mstate->__pyx_n_u_rotation, __pyx_mstate->__pyx_n_u_mmw, __pyx_mstate->__pyx_n_u_mmh, __pyx_mstate->__pyx_n_u_posinfo, __pyx_mstate->__pyx_n_u_dpiinfo, __pyx_mstate->__pyx_n_u_dpix, __pyx_mstate->__pyx_n_u_dpiy, __pyx_mstate->__pyx_n_u_dpi_2, __pyx_mstate->__pyx_n_u_mi, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_monitor_names, __pyx_mstate->__pyx_n_u_all_names, __pyx_mstate->__pyx_n_u_active_names, __pyx_mstate->__pyx_n_u_ext_chars, __pyx_mstate->__pyx_n_u_seq, __pyx_mstate->__pyx_n_u_basename, __pyx_mstate->__pyx_n_u_ext, __pyx_mstate->__pyx_n_u_delete, __pyx_mstate->__pyx_n_u_atom};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_set_crtc_config, __pyx_mstate->__pyx_kp_b_iso88591_IQ_N_1_1_aq_S_E_WA_s_1A_Qaq_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1386};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_display, __pyx_mstate->__pyx_n_u_event_base, __pyx_mstate->__pyx_n_u_error_base, __pyx_mstate->__pyx_n_u_ScreenChangeNotify};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_init_xrandr_events, __pyx_mstate->__pyx_kp_b_iso88591_A_Kq_t_AYa_1A_5_q_Q_5_Na_q_Rq_X, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1408};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_x11_bindings_randr_pyx, __pyx_mstate->__pyx_n_u_RandRBindings_2, __pyx_mstate->__pyx_kp_b_iso88591_q_z_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CommonTypesMetaclass.init */
  if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CachedMethodType.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
  {
      PyObject *typesModule=NULL;
      typesModule = PyImport_ImportModule("types");
      if (typesModule) {
          __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
          Py_DECREF(typesModule);
      }
  } // error handling follows
  #endif
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CythonFunctionShared.init */
  if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Generator.init */
  if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* TupleAndListFromArray (used by fastcall) */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
            Py_DECREF(res);
            return NULL;
        }
        Py_INCREF(src[i]);
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* PyDictVersioning (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyObjectCall (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectFastCall */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
          #if CYTHON_COMPILING_IN_LIMITED_API
            return PyObject_Vectorcall(func, args, _nargs, NULL);
          #else
            vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
            if (f) {
                return f(func, args, _nargs, NULL);
            }
          #endif
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* pybuiltin_invalid (used by pyint_simplify) */
static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) {
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    if (argname) {
        PyErr_Format(PyExc_TypeError,
            "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")",
            argname, type_name, obj_type_name
        );
    } else {
        PyErr_Format(PyExc_TypeError,
            "Expected %.200s, got " __Pyx_FMT_TYPENAME,
            type_name, obj_type_name
        );
    }
    __Pyx_DECREF_TypeName(obj_type_name);
}

/* pyint_simplify */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) {
    PyObject *number = *number_var;
    if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) {
        return 0;
    }
    PyObject *int_object;
    if (likely(PyNumber_Check(number))) {
        int_object = PyNumber_Long(number);
        if (unlikely(!int_object)) goto bad;
    } else {
        __Pyx_PyBuiltin_Invalid(number, "int", argname);
        goto bad;
    }
    *number_var = int_object;
    Py_DECREF(number);
    return 0;
bad:
    *number_var = NULL;
    Py_DECREF(number);
    return -1;
}

/* IterFinish (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyObjectCallNoArg (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallOneArg (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}
#endif

/* PyObjectCallMethod0 (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[1] = {obj};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_CallNoArg;
    return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
#endif
}

/* RaiseNeedMoreValuesToUnpack (used by UnpackTuple2) */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack (used by UnpackItemEndCheck) */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* RaiseNoneIterError (used by UnpackTupleError) */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else {
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t);
 #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(size < 0)) return;
 #endif
      if (size < index) {
        __Pyx_RaiseNeedMoreValuesError(size);
      } else {
        __Pyx_RaiseTooManyValuesError(index);
      }
    }
}

/* UnpackTuple2 (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
        PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) {
    if (likely(is_tuple || PyTuple_Check(tuple))) {
        Py_ssize_t size;
        if (has_known_size) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        size = __Pyx_PyTuple_GET_SIZE(tuple);
        if (likely(size == 2)) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        if (size >= 0) {
            __Pyx_UnpackTupleError(tuple, 2);
        }
        return -1;
    } else {
        return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple);
    }
}
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
    value1 = __Pyx_PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = __Pyx_PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = __Pyx_PyObject_GetIterNextFunc(iter);
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
#if CYTHON_COMPILING_IN_PYPY
#include <string.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#else
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
#if !CYTHON_AVOID_BORROWED_REFS
static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem) {
    PyObject *key, *value;
    if (unlikely(orig_length != PyDict_Size(iter_obj))) {
        PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
        return -1;
    }
    if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
        return 0;
    }
    if (pitem) {
        PyObject* tuple = PyTuple_New(2);
        if (unlikely(!tuple)) {
            return -1;
        }
        Py_INCREF(key);
        Py_INCREF(value);
        #if CYTHON_ASSUME_SAFE_MACROS
        PyTuple_SET_ITEM(tuple, 0, key);
        PyTuple_SET_ITEM(tuple, 1, value);
        #else
        if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) {
            Py_DECREF(value);
            Py_DECREF(tuple);
            return -1;
        }
        if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) {
            Py_DECREF(tuple);
            return -1;
        }
        #endif
        *pitem = tuple;
    } else {
        if (pkey) {
            Py_INCREF(key);
            *pkey = key;
        }
        if (pvalue) {
            Py_INCREF(value);
            *pvalue = value;
        }
    }
    return 1;
}
#endif
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_AVOID_BORROWED_REFS
    if (source_is_dict) {
        int result;
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_BEGIN_CRITICAL_SECTION(iter_obj);
#endif
        result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem);
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_END_CRITICAL_SECTION();
#endif
        return result;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(tuple_size < 0)) return -1;
        #endif
        if (unlikely(pos >= tuple_size)) return 0;
        *ppos = pos + 1;
        #if CYTHON_ASSUME_SAFE_MACROS
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        #else
        next_item = PyTuple_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #endif
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(list_size < 0)) return -1;
        #endif
        if (unlikely(pos >= list_size)) return 0;
        *ppos = pos + 1;
        next_item = __Pyx_PyList_GetItemRef(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* RaiseUnboundLocalError */
static void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* GetException (used by pep479) */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
      #endif
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc, *new_exc;
    __Pyx_PyThreadState_declare
    int is_async_stopiteration = 0;
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    __Pyx_PyThreadState_assign
    cur_exc = __Pyx_PyErr_CurrentExceptionType();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else {
            return;
        }
    }
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(tb);
    new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        "generator raised StopIteration");
    if (!new_exc) {
        Py_XDECREF(val);
        return;
    }
    PyException_SetCause(new_exc, val); // steals ref to val
    PyErr_SetObject(PyExc_RuntimeError, new_exc);
}

/* decode_c_bytes (used by decode_bytes) */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    if (unlikely((start < 0) | (stop < 0))) {
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (stop > length)
        stop = length;
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* GetTopmostException (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* CIntToDigits (used by CIntToPyUnicode) */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    Py_ssize_t padding_length = ulength - 1;
    if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) padding_length);
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= padding_length;
        memset(cpos, padding_char, (size_t) padding_length);
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, padding_length);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int)*3+2];
    char *dpos, *end = digits + sizeof(int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_RROutput(RROutput value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const RROutput neg_one = (RROutput) -1, const_zero = (RROutput) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (RROutput) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_RROutput(RROutput value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(RROutput)*3+2];
    char *dpos, *end = digits + sizeof(RROutput)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    RROutput remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const RROutput neg_one = (RROutput) -1, const_zero = (RROutput) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (RROutput) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (RROutput) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (RROutput) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* PySequenceMultiply */
#if CYTHON_USE_TYPE_SLOTS
static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) {
    PyObject *result, *pymul = PyLong_FromSsize_t(mul);
    if (unlikely(!pymul))
        return NULL;
    result = PyNumber_Multiply(seq, pymul);
    Py_DECREF(pymul);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) {
    PyTypeObject *type = Py_TYPE(seq);
    if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) {
        return type->tp_as_sequence->sq_repeat(seq, mul);
    } else {
        return __Pyx_PySequence_Multiply_Generic(seq, mul);
    }
}
#endif

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
    return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__4);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                CYTHON_COMPILING_IN_GRAAL
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
    }
    return value;
}

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
  #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
  #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
        return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
    } else
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
            return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
        } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_NewRef(PyList_GET_ITEM(o, n));
        }
    } else
    #if !CYTHON_AVOID_BORROWED_REFS
    if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
        }
    } else
    #endif
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    Py_INCREF(key);
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* dict_setdefault */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
    PyObject* value;
#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
    PyDict_SetDefaultRef(d, key, default_value, &value);
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    PyObject *args[] = {d, key, default_value};
    value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#elif CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!j)) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
            Py_INCREF(v);
            return PyList_SetItem(o, n, v);
        } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old;
            Py_INCREF(v);
            old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 0;
        }
    } else
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_SetItem(o, i, v);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* DictGetItem */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
        if (unlikely(PyTuple_Check(key))) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args)) {
                PyErr_SetObject(PyExc_KeyError, args);
                Py_DECREF(args);
            }
        } else {
            PyErr_SetObject(PyExc_KeyError, key);
        }
    }
    return value;
}
#endif

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
        return _PyObject_Vectorcall
            (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod0 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        if (likely(cfunc->flag == METH_NOARGS))
            return __Pyx_CallCFunction(cfunc, self, NULL);
        if (likely(cfunc->flag == METH_FASTCALL))
            return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
        if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
            return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
        if (cfunc->flag == METH_VARARGS)
            return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
        return __Pyx__CallUnboundCMethod0(cfunc, self);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *result;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
    result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
    return result;
}

/* py_dict_keys */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_keys, d);
}

/* PyObjectCall2Args (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallMethod1 (used by append) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* ParseKeywords */
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    int was_initialized =  __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return __Pyx_CallCFunction(cfunc, self, arg);
        } else if (flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1);
        } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, NULL);
        }
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod1(&tmp_cfunc, self, arg);
    }
#endif
    PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *args = PyTuple_New(1);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
    } else
#endif
    {
        result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg);
    }
    return result;
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (unsigned int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(unsigned int)*3+2];
    char *dpos, *end = digits + sizeof(unsigned int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    unsigned int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (unsigned int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (unsigned int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (unsigned int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(0);
    }
    ctx = PyUnicode_FromString(name);
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
    if (nogil)
        PyGILState_Release(state);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_RRMode(RRMode value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const RRMode neg_one = (RRMode) -1, const_zero = (RRMode) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (RRMode) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_RRMode(RRMode value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(RRMode)*3+2];
    char *dpos, *end = digits + sizeof(RRMode)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    RRMode remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const RRMode neg_one = (RRMode) -1, const_zero = (RRMode) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (RRMode) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (RRMode) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (RRMode) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* UnicodeConcatInPlace */
# if CYTHON_COMPILING_IN_CPYTHON
static int
__Pyx_unicode_modifiable(PyObject *unicode, int unsafe_shared)
{
    if (!__Pyx_IS_UNIQUELY_REFERENCED(unicode, unsafe_shared))
        return 0;
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030F0000
    if (PyUnstable_Unicode_GET_CACHED_HASH(unicode) != -1)
        return 0;
#endif
    if (!PyUnicode_CheckExact(unicode))
        return 0;
    if (PyUnicode_CHECK_INTERNED(unicode))
        return 0;
    return 1;
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    ) {
    PyObject *left = *p_left;
    Py_ssize_t left_len, right_len, new_len;
    if (unlikely(__Pyx_PyUnicode_READY(left) == -1))
        return NULL;
    if (unlikely(__Pyx_PyUnicode_READY(right) == -1))
        return NULL;
    left_len = PyUnicode_GET_LENGTH(left);
    if (left_len == 0) {
        Py_INCREF(right);
        return right;
    }
    right_len = PyUnicode_GET_LENGTH(right);
    if (right_len == 0) {
        Py_INCREF(left);
        return left;
    }
    if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) {
        PyErr_SetString(PyExc_OverflowError,
                        "strings are too large to concat");
        return NULL;
    }
    new_len = left_len + right_len;
    if (__Pyx_unicode_modifiable(left, unsafe_shared)
            && PyUnicode_CheckExact(right)
            && PyUnicode_KIND(right) <= PyUnicode_KIND(left)
            && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) {
        int ret;
        __Pyx_GIVEREF(*p_left);
        ret = PyUnicode_Resize(p_left, new_len);
        __Pyx_GOTREF(*p_left);
        if (unlikely(ret != 0))
            return NULL;
        #if PY_VERSION_HEX >= 0x030d0000
        if (unlikely(PyUnicode_CopyCharacters(*p_left, left_len, right, 0, right_len) < 0)) return NULL;
        #else
        _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
        #endif
        __Pyx_INCREF(*p_left);
        __Pyx_GIVEREF(*p_left);
        return *p_left;
    } else {
        return __Pyx_PyUnicode_Concat(left, right);
    }
  }
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    calculate_long:
        if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                || __Pyx_PyLong_DigitCount(op1) <= 52 / PyLong_SHIFT) {
            return PyFloat_FromDouble((double)a / (double)b);
        }
        return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_TrueDivideObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) / (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_TrueDivideObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(op1, op2, inplace);
}
#endif

/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
    PyObject *tp_dictoffset_o;
    Py_ssize_t tp_dictoffset;
    tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
    if (unlikely(!tp_dictoffset_o)) return -1;
    tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
    Py_DECREF(tp_dictoffset_o);
    if (unlikely(tp_dictoffset == 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' doesn't have a dictoffset");
        return -1;
    } else if (unlikely(tp_dictoffset < 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' has an unexpected negative dictoffset. "
            "Please report this as Cython bug");
        return -1;
    }
    return tp_dictoffset;
}
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
    static Py_ssize_t tp_dictoffset = 0;
    if (unlikely(tp_dictoffset == 0)) {
        tp_dictoffset = __Pyx_GetTypeDictOffset();
        if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
            tp_dictoffset = 0; // try again next time?
            return NULL;
        }
    }
    return *(PyObject**)((char*)tp + tp_dictoffset);
}
#endif

/* SetItemOnTypeDict (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_SetItem(tp_dict, k, v);
    if (likely(!result)) {
        PyType_Modified(tp);
        if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
            PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name,  (PyObject *) tp, k, NULL);
            if (!setNameResult) return -1;
            Py_DECREF(setNameResult);
        }
    }
    return result;
}

/* FixUpExtensionType (used by FetchCommonType) */
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if __PYX_LIMITED_VERSION_HEX > 0x030900B1
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#else
    const PyType_Slot *slot = spec->slots;
    int changed = 0;
#if !CYTHON_COMPILING_IN_LIMITED_API
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
#if !CYTHON_COMPILING_IN_CPYTHON
        const
#endif  // !CYTHON_COMPILING_IN_CPYTHON)
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_vectorcall_offset = memb->offset;
                    changed = 1;
                }
#endif  // CYTHON_METH_FASTCALL
#if !CYTHON_COMPILING_IN_PYPY
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                    Py_DECREF(descr);
                    if (unlikely(set_item_result < 0)) {
                        return -1;
                    }
                    changed = 1;
                }
#endif  // !CYTHON_COMPILING_IN_PYPY
            }
            memb++;
        }
    }
#endif  // !CYTHON_COMPILING_IN_LIMITED_API
#if !CYTHON_COMPILING_IN_PYPY
    slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_getset)
        slot++;
    if (slot && slot->slot == Py_tp_getset) {
        PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
        while (getset && getset->name) {
            if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
                PyObject *descr = PyDescr_NewGetSet(type, getset);
                if (unlikely(!descr))
                    return -1;
                #if CYTHON_COMPILING_IN_LIMITED_API
                PyObject *pyname = PyUnicode_FromString(getset->name);
                if (unlikely(!pyname)) {
                    Py_DECREF(descr);
                    return -1;
                }
                int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
                Py_DECREF(pyname);
                #else
                CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
                int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                #endif
                Py_DECREF(descr);
                if (unlikely(set_item_result < 0)) {
                    return -1;
                }
                changed = 1;
            }
            ++getset;
        }
    }
#else
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#endif  // !CYTHON_COMPILING_IN_PYPY
    if (changed)
        PyType_Modified(type);
#endif  // PY_VERSION_HEX > 0x030900B1
    return 0;
}

/* AddModuleRef (used by FetchSharedCythonModule) */
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
      PyObject *module_dict = PyImport_GetModuleDict();
      PyObject *m;
      if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
          return NULL;
      }
      if (m != NULL && PyModule_Check(m)) {
          return m;
      }
      Py_XDECREF(m);
      m = PyModule_NewObject(name);
      if (m == NULL)
          return NULL;
      if (PyDict_CheckExact(module_dict)) {
          PyObject *new_m;
          (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
          Py_DECREF(m);
          return new_m;
      } else {
           if (PyObject_SetItem(module_dict, name, m) != 0) {
                Py_DECREF(m);
                return NULL;
            }
            return m;
      }
  }
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *py_name = PyUnicode_FromString(name);
      if (!py_name) return NULL;
      PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
      Py_DECREF(py_name);
      return module;
  }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif

/* FetchSharedCythonModule (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* FetchCommonType (used by CommonTypesMetaclass) */
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
    if (result && metaclass) {
        PyObject *old_tp = (PyObject*)Py_TYPE(result);
    Py_INCREF((PyObject*)metaclass);
#if __PYX_LIMITED_VERSION_HEX >= 0x03090000
        Py_SET_TYPE(result, metaclass);
#else
        result->ob_type = metaclass;
#endif
        Py_DECREF(old_tp);
    }
    return result;
}
#else
#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
#endif
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t expected_basicsize) {
    Py_ssize_t basicsize;
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (expected_basicsize == 0) {
        return 0; // size is inherited, nothing useful to check
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
    if (unlikely(!py_basicsize)) return -1;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = NULL;
    if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
#else
    basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
#endif
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
    int get_item_ref_result;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    py_object_name = PyUnicode_FromString(object_name);
    if (!py_object_name) return NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) goto done;
    abi_module_dict = PyModule_GetDict(abi_module);
    if (!abi_module_dict) goto done;
    get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
    if (get_item_ref_result == 1) {
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else if (unlikely(get_item_ref_result == -1)) {
        goto bad;
    }
    cached_type = __Pyx_PyType_FromMetaclass(
        metaclass,
        CYTHON_USE_MODULE_STATE ? module : abi_module,
        spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
    if (unlikely(new_cached_type != cached_type)) {
        if (unlikely(!new_cached_type)) goto bad;
        Py_DECREF(cached_type);
        cached_type = new_cached_type;
        if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else {
        Py_DECREF(new_cached_type);
    }
done:
    Py_XDECREF(abi_module);
    Py_DECREF(py_object_name);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CommonTypesMetaclass (used by CythonFunctionShared) */
static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
    return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
}
#if __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
    PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
    return NULL;
}
static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
    PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
    return -1;
}
#endif
static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
    {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
    {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
    #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
    #endif
    {0, 0}
};
static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
    __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
    0,
    0,
    Py_TPFLAGS_IMMUTABLETYPE |
    Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT,
    __pyx_CommonTypesMetaclass_slots
};
static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    PyObject *bases = PyTuple_Pack(1, &PyType_Type);
    if (unlikely(!bases)) {
        return -1;
    }
    mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
    Py_DECREF(bases);
    if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
        return -1;
    }
    return 0;
}

/* CallTypeTraverse (used by CythonFunctionShared) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
    if (__Pyx_get_runtime_version() < 0x03090000) return 0;
    #endif
    if (!always_call) {
        PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
        unsigned long flags = PyType_GetFlags(base);
        if (flags & Py_TPFLAGS_HEAPTYPE) {
            return 0;
        }
    }
    Py_VISIT((PyObject*)Py_TYPE(o));
    return 0;
}
#endif

/* PyMethodNew (used by CythonFunctionShared) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *result;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    {
        PyObject *args[] = {func, self};
        result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
    }
    #else
    result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
    #endif
    return result;
}
#else
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    return PyMethod_New(func, self);
}
#endif

/* py_dict_items (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

/* py_dict_values (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
}

/* OwnedDictNext (used by PyVectorcallFastCallDict) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
    PyObject *next = NULL;
    if (!*ppos) {
        if (pvalue) {
            PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
            if (unlikely(!dictview)) goto bad;
            *ppos = PyObject_GetIter(dictview);
            Py_DECREF(dictview);
        } else {
            *ppos = PyObject_GetIter(p);
        }
        if (unlikely(!*ppos)) goto bad;
    }
    next = PyIter_Next(*ppos);
    if (!next) {
        if (PyErr_Occurred()) goto bad;
        return 0;
    }
    if (pkey && pvalue) {
        *pkey = __Pyx_PySequence_ITEM(next, 0);
        if (unlikely(*pkey)) goto bad;
        *pvalue = __Pyx_PySequence_ITEM(next, 1);
        if (unlikely(*pvalue)) goto bad;
        Py_DECREF(next);
    } else if (pkey) {
        *pkey = next;
    } else {
        assert(pvalue);
        *pvalue = next;
    }
    return 1;
  bad:
    Py_XDECREF(next);
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
#else
    PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
#endif
    if (pkey) *pkey = NULL;
    if (pvalue) *pvalue = NULL;
    return 0;
}
#else // !CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
    int result = PyDict_Next(p, ppos, pkey, pvalue);
    if (likely(result == 1)) {
        if (pkey) Py_INCREF(*pkey);
        if (pvalue) Py_INCREF(*pvalue);
    }
    return result;
}
#endif

/* PyVectorcallFastCallDict (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    PyObject *res = NULL;
    PyObject *kwnames;
    PyObject **newargs;
    PyObject **kwvalues;
    Py_ssize_t i;
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos;
    #else
    Py_ssize_t pos;
    #endif
    size_t j;
    PyObject *key, *value;
    unsigned long keys_are_strings;
    #if !CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t nkw = PyDict_Size(kw);
    if (unlikely(nkw == -1)) return NULL;
    #else
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    #endif
    newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
    if (unlikely(newargs == NULL)) {
        PyErr_NoMemory();
        return NULL;
    }
    for (j = 0; j < nargs; j++) newargs[j] = args[j];
    kwnames = PyTuple_New(nkw);
    if (unlikely(kwnames == NULL)) {
        PyMem_Free(newargs);
        return NULL;
    }
    kwvalues = newargs + nargs;
    pos = 0;
    i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
        keys_are_strings &=
        #if CYTHON_COMPILING_IN_LIMITED_API
            PyType_GetFlags(Py_TYPE(key));
        #else
            Py_TYPE(key)->tp_flags;
        #endif
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
        #else
        PyTuple_SET_ITEM(kwnames, i, key);
        #endif
        kwvalues[i] = value;
        i++;
    }
    if (unlikely(!keys_are_strings)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        goto cleanup;
    }
    res = vc(func, newargs, nargs, kwnames);
cleanup:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(pos);
    #endif
    Py_DECREF(kwnames);
    for (i = 0; i < nkw; i++)
        Py_DECREF(kwvalues[i]);
    PyMem_Free(newargs);
    return res;
}
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    Py_ssize_t kw_size =
        likely(kw == NULL) ?
        0 :
#if !CYTHON_ASSUME_SAFE_SIZE
        PyDict_Size(kw);
#else
        PyDict_GET_SIZE(kw);
#endif
    if (kw_size == 0) {
        return vc(func, args, nargs, NULL);
    }
#if !CYTHON_ASSUME_SAFE_SIZE
    else if (unlikely(kw_size == -1)) {
        return NULL;
    }
#endif
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared (used by CythonFunction) */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
    if (__Pyx_CyFunction_Check(func)) {
        return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
    } else if (PyCFunction_Check(func)) {
        return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
        int result;
        PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
        if (unlikely(!newFunc)) {
            PyErr_Clear(); // It's only an optimization, so don't throw an error
            return 0;
        }
        result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
        Py_DECREF(newFunc);
        return result;
    }
    return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if (PyMethod_Check(func)) {
        func = PyMethod_GET_FUNCTION(func);
    }
    return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
}
#endif
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_Py_XDECREF_SET(
        __Pyx_CyFunction_GetClassObj(f),
            ((classobj) ? __Pyx_NewRef(classobj) : NULL));
#else
    __Pyx_Py_XDECREF_SET(
        ((PyCMethodObject *) (f))->mm_class,
        (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
#endif
}
static PyObject *
__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_doc == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
        if (unlikely(!op->func_doc)) return NULL;
#else
        if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
#endif
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
    PyObject *result;
    CYTHON_UNUSED_VAR(closure);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_doc_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_doc, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#else
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_name_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    Py_INCREF(op->func_qualname);
    result = op->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
#endif
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_defaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_kwdefaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value || value == Py_None) {
        value = NULL;
    } else if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_annotations, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_annotations_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
    int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
    if (is_coroutine) {
        PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
        fromlist = PyList_New(1);
        if (unlikely(!fromlist)) return NULL;
        Py_INCREF(marker);
#if CYTHON_ASSUME_SAFE_MACROS
        PyList_SET_ITEM(fromlist, 0, marker);
#else
        if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
            Py_DECREF(marker);
            Py_DECREF(fromlist);
            return NULL;
        }
#endif
        module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(is_coroutine_value)) {
            return is_coroutine_value;
        }
ignore:
        PyErr_Clear();
    }
    return __Pyx_PyBool_FromLong(is_coroutine);
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    result = __Pyx_CyFunction_get_is_coroutine_value(op);
    if (unlikely(!result))
        return NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    if (op->func_is_coroutine) {
        Py_DECREF(result);
        result = __Pyx_NewRef(op->func_is_coroutine);
    } else {
        op->func_is_coroutine = __Pyx_NewRef(result);
    }
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        py_name, message, size);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        name, message, size);
#endif
}
static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s",
        py_name, message);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s",
        name, message);
#endif
}
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_GetAttrString(op->func, "__module__");
}
static int
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_SetAttrString(op->func, "__module__", value);
}
#endif
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
#else
    {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
#endif
    {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
#if !CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#endif
#if CYTHON_METH_FASTCALL
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
#endif
#endif
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(args);
    __Pyx_BEGIN_CRITICAL_SECTION(m);
    Py_INCREF(m->func_qualname);
    result = m->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyCFunctionObject *cf = (PyCFunctionObject*) op;
#endif
    if (unlikely(op == NULL))
        return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
    if (unlikely(!op->func)) return NULL;
#endif
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
#if !CYTHON_COMPILING_IN_LIMITED_API
    cf->m_ml = ml;
    cf->m_self = (PyObject *) op;
#endif
    Py_XINCREF(closure);
    op->func_closure = closure;
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_XINCREF(module);
    cf->m_module = module;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_dict = NULL;
#endif
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func_dict);
#elif PY_VERSION_HEX < 0x030d0000
    _PyObject_ClearManagedDict((PyObject*)m);
#else
    PyObject_ClearManagedDict((PyObject*)m);
#endif
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
#if PY_VERSION_HEX < 0x030900B1
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    Py_CLEAR(m->defaults);
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __Pyx_PyHeapTypeObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    {
        int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func);
#else
    Py_VISIT(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func_dict);
#else
    {
        int e =
#if PY_VERSION_HEX < 0x030d0000
            _PyObject_VisitManagedDict
#else
            PyObject_VisitManagedDict
#endif
                ((PyObject*)m, visit, arg);
        if (e != 0) return e;
    }
#endif
    __Pyx_VISIT_CONST(m->func_name);
    __Pyx_VISIT_CONST(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    __Pyx_VISIT_CONST(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
#endif
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_is_coroutine);
    Py_VISIT(m->defaults);
    return 0;
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
    PyObject *repr;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
    __Pyx_END_CRITICAL_SECTION();
    return repr;
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyCFunction meth;
    int flags;
    meth = PyCFunction_GetFunction(f);
    if (unlikely(!meth)) return NULL;
    flags = PyCFunction_GetFlags(f);
    if (unlikely(flags < 0)) return NULL;
#else
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    int flags = f->m_ml->ml_flags;
#endif
    Py_ssize_t size;
    switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 0))
                return (*meth)(self, NULL);
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes no arguments", size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes exactly one argument", size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
    __Pyx_CyFunction_raise_type_error(
        (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *self, *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
    if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
    self = ((PyCFunctionObject*)func)->m_self;
#endif
    result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
    return result;
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
        return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
#else
        (void) &__Pyx_PyVectorcall_FastCallDict;
        return PyVectorcall_Call(func, args, kw);
#endif
    }
#endif
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
#if CYTHON_ASSUME_SAFE_SIZE
        argc = PyTuple_GET_SIZE(args);
#else
        argc = PyTuple_Size(args);
        if (unlikely(argc < 0)) return NULL;
#endif
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
{
    int ret = 0;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        if (unlikely(nargs < 1)) {
            __Pyx_CyFunction_raise_type_error(
                cyfunc, "needs an argument");
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
        __Pyx_CyFunction_raise_type_error(
            cyfunc, "takes no keyword arguments");
        return -1;
    }
    return ret;
}
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes no arguments", nargs);
        return NULL;
    }
    return meth(self, NULL);
}
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes exactly one argument", nargs);
        return NULL;
    }
    return meth(self, args[0]);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    #if PY_VERSION_HEX < 0x030e00A6
    size_t nargs_value = (size_t) nargs;
    #else
    Py_ssize_t nargs_value = nargs;
    #endif
    return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
}
#endif
static PyType_Slot __pyx_CyFunctionType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
    {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
    {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
    {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
    {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
    {Py_tp_methods, (void *)__pyx_CyFunction_methods},
    {Py_tp_members, (void *)__pyx_CyFunction_members},
    {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
    {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
    {0, 0},
};
static PyType_Spec __pyx_CyFunctionType_spec = {
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if CYTHON_METH_FASTCALL
#if defined(Py_TPFLAGS_HAVE_VECTORCALL)
    Py_TPFLAGS_HAVE_VECTORCALL |
#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
#endif // CYTHON_METH_FASTCALL
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_DICT |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
static int __pyx_CyFunction_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
    if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
    if (unlikely(!m->defaults))
        return NULL;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
        }
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *result = NULL;
        PyObject *args = PyTuple_New(2);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
        return result;
    }
#endif
    {
        PyObject *args[4] = {NULL, self, arg1, arg2};
        return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
    }
}

/* dict_getitem_default */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
    if ((1));
#else
    if (PyBytes_CheckExact(key) || PyUnicode_CheckExact(key) || PyLong_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_RRCrtc(RRCrtc value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const RRCrtc neg_one = (RRCrtc) -1, const_zero = (RRCrtc) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (RRCrtc) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_RRCrtc(RRCrtc value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(RRCrtc)*3+2];
    char *dpos, *end = digits + sizeof(RRCrtc)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    RRCrtc remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const RRCrtc neg_one = (RRCrtc) -1, const_zero = (RRCrtc) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (RRCrtc) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (RRCrtc) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (RRCrtc) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 1;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) == 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 0;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 0;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal == 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a == (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
#if PY_VERSION_HEX >= 0x030C00A7
    if (likely(__Pyx_PyLong_IsCompact(n))) {
        return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
    }
#else
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
    }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            #if PY_VERSION_HEX >= 0x030C00A7
            ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
            #else
            __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
            #endif
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a + b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla + llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* PyUnicode_Substring */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length;
    #if !CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL;
    #endif
    length = __Pyx_PyUnicode_GET_LENGTH(text);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(length < 0)) return NULL;
    #endif
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    if (stop <= start)
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode);
    if (start == 0 && stop == length)
        return __Pyx_NewRef(text);
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyUnicode_Substring(text, start, stop);
#else
    return PyUnicode_FromKindAndData(PyUnicode_KIND(text),
        PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start);
#endif
}

/* CallNextTpDealloc */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
    PyTypeObject* type = Py_TYPE(obj);
    destructor tp_dealloc = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_dealloc, destructor) != current_tp_dealloc)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_dealloc = __Pyx_PyType_GetSlot(type, tp_dealloc, destructor)) == current_tp_dealloc)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type)
        tp_dealloc(obj);
}

/* CallNextTpTraverse */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    traverseproc tp_traverse = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc) != current_tp_traverse)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_traverse = __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc)) == current_tp_traverse)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type && tp_traverse)
        return tp_traverse(obj, v, a);
    return 0;
}

/* CallNextTpClear */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    inquiry tp_clear = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_clear, inquiry) != current_tp_clear)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_clear = __Pyx_PyType_GetSlot(type, tp_clear, inquiry)) == current_tp_clear)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type && tp_clear)
        tp_clear(obj);
}

/* AllocateExtensionType */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
    if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
        allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
        return alloc_func(t, 0);
    } else {
        newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (!tp_new) {
            PyObject *new_str = PyUnicode_FromString("__new__");
            if (likely(new_str)) {
                PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
                Py_DECREF(new_str);
                return o;
            } else
                return NULL;
        } else
    #endif
        return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
    }
}

/* FunctionExport */
static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig) {
    PyObject *cobj;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    tmp.fp = f;
    cobj = PyCapsule_New(tmp.p, sig, 0);
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(api_dict, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    return 0;
bad:
    Py_XDECREF(cobj);
    return -1;
}

/* GetApiDict */
static PyObject *__Pyx_ApiExport_GetApiDict(void) {
    PyObject *d;
    if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1)
        return NULL;
    if (!d) {
        d = PyDict_New();
        if (!d)
            goto bad;
        if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0)
            goto bad;
    }
    return d;
bad:
    Py_XDECREF(d);
    return NULL;
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_2_4
#define __PYX_HAVE_RT_ImportType_3_2_4
static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size)
{
    PyObject *result = 0;
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API)
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) )
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    if (size == 0) {
        return (PyTypeObject *)result;
    }
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize+itemsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_4 &&
            ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd-%zd from PyObject",
            module_name, class_name, size, basicsize, basicsize+itemsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_4 && (size_t)basicsize > size) {
        if (PyErr_WarnFormat(NULL, 0,
                "%.200s.%.200s size changed, may indicate binary incompatibility. "
                "Expected %zd from C header, got %zd from PyObject",
                module_name, class_name, size, basicsize) < 0) {
            goto bad;
        }
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
static void* __Pyx_GetVtable(PyTypeObject *type) {
    void* ptr;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#endif
    if (!ob)
        goto bad;
    ptr = PyCapsule_GetPointer(ob, 0);
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* ValidateBasesTuple (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_SIZE
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (unlikely(n < 0)) return -1;
#endif
    for (i = 1; i < n; i++)
    {
        PyTypeObject *b;
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *b0 = PySequence_GetItem(bases, i);
        if (!b0) return -1;
#elif CYTHON_ASSUME_SAFE_MACROS
        PyObject *b0 = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *b0 = PyTuple_GetItem(bases, i);
        if (!b0) return -1;
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
            PyErr_Format(PyExc_TypeError,
                "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
            __Pyx_DECREF_TypeName(b_name);
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
        if (dictoffset == 0)
        {
            Py_ssize_t b_dictoffset = 0;
#if CYTHON_USE_TYPE_SLOTS
            b_dictoffset = b->tp_dictoffset;
#else
            PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
            if (!py_b_dictoffset) goto dictoffset_return;
            b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
            Py_DECREF(py_b_dictoffset);
            if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
#endif
            if (b_dictoffset) {
                {
                    __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                    PyErr_Format(PyExc_TypeError,
                        "extension type '%.200s' has no __dict__ slot, "
                        "but base type '" __Pyx_FMT_TYPENAME "' has: "
                        "either add 'cdef dict __dict__' to the extension type "
                        "or add '__slots__ = [...]' to the base type",
                        type_name, b_name);
                    __Pyx_DECREF_TypeName(b_name);
                }
#if !CYTHON_USE_TYPE_SLOTS
              dictoffset_return:
#endif
#if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(b0);
#endif
                return -1;
            }
        }
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(b0);
#endif
    }
    return 0;
}
#endif

/* PyType_Ready */
CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
    while (t) {
        PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
        if (bases) {
            return 1;
        }
        t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
    }
    return 0;
}
static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
    (void)__Pyx_PyObject_CallMethod0;
#if CYTHON_USE_TYPE_SPECS
    (void)__Pyx_validate_bases_tuple;
#endif
    return PyType_Ready(t);
#else
    int r;
    if (!__Pyx_PyType_HasMultipleInheritance(t)) {
        return PyType_Ready(t);
    }
    PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
    if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
        return -1;
#if !defined(PYSTON_MAJOR_VERSION)
    {
        int gc_was_enabled;
    #if PY_VERSION_HEX >= 0x030A00b1
        gc_was_enabled = PyGC_Disable();
        (void)__Pyx_PyObject_CallMethod0;
    #else
        PyObject *ret, *py_status;
        PyObject *gc = NULL;
        #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                !CYTHON_COMPILING_IN_GRAAL
        gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
        if (unlikely(!py_status)) {
            Py_DECREF(gc);
            return -1;
        }
        gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
        Py_DECREF(py_status);
        if (gc_was_enabled > 0) {
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
            if (unlikely(!ret)) {
                Py_DECREF(gc);
                return -1;
            }
            Py_DECREF(ret);
        } else if (unlikely(gc_was_enabled == -1)) {
            Py_DECREF(gc);
            return -1;
        }
    #endif
        t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#if PY_VERSION_HEX >= 0x030A0000
        t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
#endif
#else
        (void)__Pyx_PyObject_CallMethod0;
#endif
    r = PyType_Ready(t);
#if !defined(PYSTON_MAJOR_VERSION)
        t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
    #if PY_VERSION_HEX >= 0x030A00b1
        if (gc_was_enabled)
            PyGC_Enable();
    #else
        if (gc_was_enabled) {
            PyObject *tp, *v, *tb;
            PyErr_Fetch(&tp, &v, &tb);
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
            if (likely(ret || r == -1)) {
                Py_XDECREF(ret);
                PyErr_Restore(tp, v, tb);
            } else {
                Py_XDECREF(tp);
                Py_XDECREF(v);
                Py_XDECREF(tb);
                r = -1;
            }
        }
        Py_DECREF(gc);
    #endif
    }
#endif
    return r;
#endif
}

/* SetVTable */
static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
    if (unlikely(!ob))
        goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#endif
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* MergeVTables */
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i=0;
    Py_ssize_t size;
    void** base_vtables;
    __Pyx_TypeName tp_base_name = NULL;
    __Pyx_TypeName base_name = NULL;
    void* unknown = (void*)-1;
    PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
    int base_depth = 0;
    {
        PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        while (base) {
            base_depth += 1;
            base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
        }
    }
    base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
#if CYTHON_COMPILING_IN_LIMITED_API
    size = PyTuple_Size(bases);
    if (size < 0) goto other_failure;
#else
    size = PyTuple_GET_SIZE(bases);
#endif
    for (i = 1; i < size; i++) {
        PyObject *basei;
        void* base_vtable;
#if CYTHON_AVOID_BORROWED_REFS
        basei = PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#else
        basei = PyTuple_GET_ITEM(bases, i);
#endif
        base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
            }
        }
    }
    PyErr_Clear();
    PyMem_Free(base_vtables);
    return 0;
bad:
    {
        PyTypeObject* basei = NULL;
        PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
#if CYTHON_AVOID_BORROWED_REFS
        basei = (PyTypeObject*)PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#else
        basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
#endif
        base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
    }
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
really_bad: // bad has failed!
#endif
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
other_failure:
#endif
    PyMem_Free(base_vtables);
    return -1;
}

/* PxdImportShared (used by FunctionImport) */
#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_4
#define __PYX_HAVE_RT_ImportFromPxd_3_2_4
static int __Pyx_ImportFromPxd_3_2_4(PyObject *module, const char *name, void **p, const char *sig, const char *what) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, "__pyx_capi__");
    if (!d)
        goto bad;
#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000)
    PyDict_GetItemStringRef(d, name, &cobj);
#else
    cobj = PyDict_GetItemString(d, name);
    Py_XINCREF(cobj);
#endif
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C %.8s %.200s",
                PyModule_GetName(module), what, name);
        goto bad;
    }
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    Py_DECREF(cobj);
    return 0;
bad:
    Py_XDECREF(d);
    Py_XDECREF(cobj);
    return -1;
}
#endif

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction_3_2_4
#define __PYX_HAVE_RT_ImportFunction_3_2_4
static int __Pyx_ImportFunction_3_2_4(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    int result = __Pyx_ImportFromPxd_3_2_4(module, funcname, &tmp.p, sig, "function");
    if (result == 0) {
        *f = tmp.fp;
    }
    return result;
}
#endif

/* CLineInTraceback (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
#else
PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
    PyObject **dict_ptr = _PyObject_GetDictPtr(o);
    return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
}
#endif
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline = NULL;
    PyObject *ptype, *pvalue, *ptraceback;
    PyObject *cython_runtime_dict;
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
    cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, cython_runtime_dict,
            __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
    }
    if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    Py_XDECREF(use_cline);
    Py_XDECREF(cython_runtime_dict);
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache (used by AddTraceback) */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
    __Pyx_CachedCodeObjectType* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = code_cache->entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__find_code_object;
    return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
    if (old_count < 0) {
        __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
        return NULL;
    }
#endif
    __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
#endif
    return result;
#endif
}
static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
{
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            code_cache->entries = entries;
            code_cache->max_count = 64;
            code_cache->count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
        __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_INCREF(code_object);
        Py_DECREF(tmp);
        return;
    }
    if (code_cache->count == code_cache->max_count) {
        int new_max = code_cache->max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        code_cache->entries = entries;
        code_cache->max_count = new_max;
    }
    for (i=code_cache->count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    code_cache->count++;
    Py_INCREF(code_object);
}
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__insert_code_object;
    return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type expected = 0;
    if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
        return;
    }
#endif
    __pyx__insert_code_object(code_cache, code_line, code_object);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
#endif
#endif
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                       PyObject *firstlineno, PyObject *name) {
    PyObject *replace = NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
    replace = PyObject_GetAttrString(code, "replace");
    if (likely(replace)) {
        PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
    PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
    PyObject *exc_type, *exc_value, *exc_traceback;
    int success = 0;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
    }
    PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
    code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!code_object) {
        code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
        if (unlikely(!code_object)) goto bad;
        py_py_line = PyLong_FromLong(py_line);
        if (unlikely(!py_py_line)) goto bad;
        if (c_line) {
            py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        } else {
            py_funcname = PyUnicode_FromString(funcname);
        }
        if (unlikely(!py_funcname)) goto bad;
        dict = PyDict_New();
        if (unlikely(!dict)) goto bad;
        {
            PyObject *old_code_object = code_object;
            code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
            Py_DECREF(old_code_object);
        }
        if (unlikely(!code_object)) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
    } else {
        dict = PyDict_New();
    }
    getframe = PySys_GetObject("_getframe");
    if (unlikely(!getframe)) goto bad;
    if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
    frame = PyEval_EvalCode(code_object, dict, dict);
    if (unlikely(!frame) || frame == Py_None) goto bad;
    success = 1;
  bad:
    PyErr_Restore(exc_type, exc_value, exc_traceback);
    Py_XDECREF(code_object);
    Py_XDECREF(py_py_line);
    Py_XDECREF(py_funcname);
    Py_XDECREF(dict);
    Py_XDECREF(replace);
    if (success) {
        PyTraceBack_Here(
            (struct _frame*)frame);
    }
    Py_XDECREF(frame);
}
#else
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    if (c_line) {
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
    }
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_mstate_global->__pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
#endif

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_Rotation(Rotation value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Rotation neg_one = (Rotation) -1, const_zero = (Rotation) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Rotation) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(Rotation) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(Rotation) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Rotation) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(Rotation) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(Rotation),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(Rotation));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_Connection(Connection value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Connection neg_one = (Connection) -1, const_zero = (Connection) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Connection) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(Connection) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(Connection) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Connection) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(Connection) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(Connection),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(Connection));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE Rotation __Pyx_PyLong_As_Rotation(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Rotation neg_one = (Rotation) -1, const_zero = (Rotation) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        Rotation val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (Rotation) -1;
        val = __Pyx_PyLong_As_Rotation(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(Rotation, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(Rotation) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) >= 2 * PyLong_SHIFT)) {
                            return (Rotation) (((((Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(Rotation) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) >= 3 * PyLong_SHIFT)) {
                            return (Rotation) (((((((Rotation)digits[2]) << PyLong_SHIFT) | (Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(Rotation) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) >= 4 * PyLong_SHIFT)) {
                            return (Rotation) (((((((((Rotation)digits[3]) << PyLong_SHIFT) | (Rotation)digits[2]) << PyLong_SHIFT) | (Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (Rotation) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(Rotation) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(Rotation, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(Rotation) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(Rotation, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(Rotation, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(Rotation) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) - 1 > 2 * PyLong_SHIFT)) {
                            return (Rotation) (((Rotation)-1)*(((((Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(Rotation) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) - 1 > 2 * PyLong_SHIFT)) {
                            return (Rotation) ((((((Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(Rotation) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) - 1 > 3 * PyLong_SHIFT)) {
                            return (Rotation) (((Rotation)-1)*(((((((Rotation)digits[2]) << PyLong_SHIFT) | (Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(Rotation) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) - 1 > 3 * PyLong_SHIFT)) {
                            return (Rotation) ((((((((Rotation)digits[2]) << PyLong_SHIFT) | (Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(Rotation) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) - 1 > 4 * PyLong_SHIFT)) {
                            return (Rotation) (((Rotation)-1)*(((((((((Rotation)digits[3]) << PyLong_SHIFT) | (Rotation)digits[2]) << PyLong_SHIFT) | (Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(Rotation) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(Rotation, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(Rotation) - 1 > 4 * PyLong_SHIFT)) {
                            return (Rotation) ((((((((((Rotation)digits[3]) << PyLong_SHIFT) | (Rotation)digits[2]) << PyLong_SHIFT) | (Rotation)digits[1]) << PyLong_SHIFT) | (Rotation)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(Rotation) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(Rotation, long, PyLong_AsLong(x))
        } else if ((sizeof(Rotation) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(Rotation, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        Rotation val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (Rotation) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (Rotation) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (Rotation) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (Rotation) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(Rotation) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((Rotation) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(Rotation) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((Rotation) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((Rotation) 1) << (sizeof(Rotation) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (Rotation) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to Rotation");
    return (Rotation) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to Rotation");
    return (Rotation) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyLong_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (int) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
        } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (int) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyLong_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) {
                            return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) {
                            return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT)) {
                            return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (unsigned int) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(unsigned int) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(unsigned int) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
        } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        unsigned int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (unsigned int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (unsigned int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (unsigned int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (unsigned int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((unsigned int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((unsigned int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (unsigned int) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_int(unsigned int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned int) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE unsigned long __Pyx_PyLong_As_unsigned_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (unsigned long) -1;
        val = __Pyx_PyLong_As_unsigned_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(unsigned long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT)) {
                            return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT)) {
                            return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) >= 4 * PyLong_SHIFT)) {
                            return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (unsigned long) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(unsigned long) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(unsigned long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(unsigned long) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x))
        } else if ((sizeof(unsigned long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        unsigned long val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (unsigned long) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (unsigned long) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (unsigned long) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (unsigned long) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(unsigned long) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((unsigned long) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(unsigned long) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((unsigned long) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((unsigned long) 1) << (sizeof(unsigned long) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (unsigned long) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned long");
    return (unsigned long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned long");
    return (unsigned long) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_long(unsigned long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned long) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_XRRModeFlags(XRRModeFlags value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const XRRModeFlags neg_one = (XRRModeFlags) -1, const_zero = (XRRModeFlags) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(XRRModeFlags) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(XRRModeFlags) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(XRRModeFlags) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(XRRModeFlags) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(XRRModeFlags) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(XRRModeFlags),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(XRRModeFlags));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_SubpixelOrder(SubpixelOrder value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const SubpixelOrder neg_one = (SubpixelOrder) -1, const_zero = (SubpixelOrder) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(SubpixelOrder) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(SubpixelOrder) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(SubpixelOrder) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(SubpixelOrder) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(SubpixelOrder) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(SubpixelOrder),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(SubpixelOrder));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_short(unsigned short value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned short neg_one = (unsigned short) -1, const_zero = (unsigned short) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned short) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned short) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned short) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned short) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned short),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned short));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyLong_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (size_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(size_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(size_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
        } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        size_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (size_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (size_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (size_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (size_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((size_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((size_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (size_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_short(short value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const short neg_one = (short) -1, const_zero = (short) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(short) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(short) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(short) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(short),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(short));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyLong_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (long) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(long) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(long) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
        } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        long val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (long) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (long) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (long) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (long) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((long) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((long) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (long) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FormatTypeName */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
static __Pyx_TypeName
__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
{
    PyObject *module = NULL, *name = NULL, *result = NULL;
    #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
    name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_qualname);
    #else
    name = PyType_GetQualName(tp);
    #endif
    if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
    module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_module);
    if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
    if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
        result = name;
        name = NULL;
        goto done;
    }
    result = PyUnicode_FromFormat("%U.%U", module, name);
    if (unlikely(result == NULL)) goto bad;
  done:
    Py_XDECREF(name);
    Py_XDECREF(module);
    return result;
  bad:
    PyErr_Clear();
    if (name) {
        result = name;
        name = NULL;
    } else {
        result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__11);
    }
    goto done;
}
#endif

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* GetRuntimeVersion */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
void __Pyx_init_runtime_version(void) {
    if (__Pyx_cached_runtime_version == 0) {
        const char* rt_version = Py_GetVersion();
        unsigned long version = 0;
        unsigned long factor = 0x01000000UL;
        unsigned int digit = 0;
        int i = 0;
        while (factor) {
            while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                ++i;
            }
            version += factor * digit;
            if (rt_version[i] != '.')
                break;
            digit = 0;
            factor >>= 8;
            ++i;
        }
        __Pyx_cached_runtime_version = version;
    }
}
#endif
static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    return Py_Version & ~0xFFUL;
#else
    return __Pyx_cached_runtime_version;
#endif
}

/* IterNextPlain (used by CoroutineBase) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
    if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
        __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
    return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    PyObject *result;
    PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
    if (unlikely(!next)) return NULL;
    result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
    return result;
#else
    (void)__Pyx_GetBuiltinName; // only for early limited API
    iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
    assert(iternext);
    return iternext(iterator);
#endif
}

/* ReturnWithStopIteration (used by CoroutineBase) */
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
    if (value == Py_None) {
        if (async || !iternext)
            PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
        return;
    }
    __Pyx__ReturnWithStopIteration(value, async);
}
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
#if CYTHON_COMPILING_IN_CPYTHON
    __Pyx_PyThreadState_declare
#endif
    PyObject *exc;
    PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
#if CYTHON_COMPILING_IN_CPYTHON
    if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        if (PY_VERSION_HEX >= (0x030e00A1)) {
            exc = __Pyx_PyObject_CallOneArg(exc_type, value);
        } else {
            PyObject *args_tuple = PyTuple_New(1);
            if (unlikely(!args_tuple)) return;
            Py_INCREF(value);
            PyTuple_SET_ITEM(args_tuple, 0, value);
            exc = PyObject_Call(exc_type, args_tuple, NULL);
            Py_DECREF(args_tuple);
        }
        if (unlikely(!exc)) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_value)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(exc_type);
        __Pyx_ErrRestore(exc_type, exc, NULL);
        return;
    }
    #endif
#else
    exc = __Pyx_PyObject_CallOneArg(exc_type, value);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(exc_type, exc);
    Py_DECREF(exc);
}

/* CoroutineBase (used by Generator) */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#endif // CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE void
__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
#if CYTHON_USE_AM_SEND
    gen->yieldfrom_am_send = NULL;
#endif
    Py_CLEAR(gen->yieldfrom);
}
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    CYTHON_UNUSED_VAR(__pyx_tstate);
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
            value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
            if (unlikely(!value)) goto limited_api_failure;
            #else
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            #endif
            Py_DECREF(ev);
        }
        else if (unlikely(PyTuple_Check(ev))) {
            Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(tuple_size < 0)) {
                Py_XDECREF(tb);
                Py_DECREF(ev);
                Py_DECREF(et);
                return -1;
            }
            #endif
            if (tuple_size >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#elif CYTHON_ASSUME_SAFE_MACROS
                value = PySequence_ITEM(ev, 0);
#else
                value = PySequence_GetItem(ev, 0);
                if (!value) goto limited_api_failure;
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
#else
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
#endif
    Py_DECREF(ev);
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!value)) return -1;
#endif
    *pvalue = value;
    return 0;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  limited_api_failure:
    Py_XDECREF(et);
    Py_XDECREF(tb);
    Py_XDECREF(ev);
    return -1;
#endif
}
static CYTHON_INLINE
__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
    if (*retval) {
        return PYGEN_NEXT;
    } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
        return PYGEN_RETURN;
    } else {
        return PYGEN_ERROR;
    }
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_CLEAR(exc_state->exc_value);
#else
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
#endif
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    CYTHON_MAYBE_UNUSED_VAR(closing);
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(__Pyx_Coroutine_get_is_running(self));  // Callers should ensure is_running
    if (unlikely(self->resume_label == -1)) {
        __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
        return PYGEN_ERROR;
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_value) {
        #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        #else
        PyObject *exc_tb;
        #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
        exc_tb = PyException_GetTraceback(exc_state->exc_value);
        #elif PY_VERSION_HEX >= 0x030B00a4
        exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
        #else
        exc_tb = exc_state->exc_traceback;
        #endif
        if (exc_tb) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
            #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
            Py_DECREF(exc_tb);
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    retval = self->body(self, tstate, value);
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    *result = retval;
    if (self->resume_label == -1) {
        return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
    }
    return PYGEN_NEXT;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(exc_state);
#else
    PyObject *exc_tb;
    #if PY_VERSION_HEX >= 0x030B00a4
    if (!exc_state->exc_value) return;
    exc_tb = PyException_GetTraceback(exc_state->exc_value);
    #else
    exc_tb = exc_state->exc_traceback;
    #endif
    if (likely(exc_tb)) {
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
        #if PY_VERSION_HEX >= 0x030B00a4
        Py_DECREF(exc_tb);
        #endif
    }
#endif
}
#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
    ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
static PyObject *
__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (likely(result == PYGEN_RETURN)) {
        int is_async = 0;
        #ifdef __Pyx_AsyncGen_USED
        is_async = __Pyx_AsyncGen_CheckExact(gen);
        #endif
        __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
        Py_XDECREF(retval);
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
#if PY_VERSION_HEX < 0x030d00A1
            _PyGen_SetStopIterationValue(result);
#else
            if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                PyErr_SetObject(PyExc_StopIteration, result);
            } else {
                PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                if (likely(exc != NULL)) {
                    PyErr_SetObject(PyExc_StopIteration, exc);
                    Py_DECREF(exc);
                }
            }
#endif
        }
        Py_DECREF(result);
        result = NULL;
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE __Pyx_PySendResult
__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
    __Pyx_PySendResult result;
    PyObject *val = NULL;
    assert(__Pyx_Coroutine_get_is_running(gen));
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
    Py_XDECREF(val);
    return result;
}
#if CYTHON_USE_AM_SEND
static __Pyx_PySendResult
__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
    PyObject *ret = NULL;
    __Pyx_PySendResult delegate_result, result;
    assert(__Pyx_Coroutine_get_is_running(gen));
    delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
    if (delegate_result == PYGEN_NEXT) {
        assert (ret != NULL);
        *retval = ret;
        return PYGEN_NEXT;
    }
    assert (delegate_result != PYGEN_ERROR || ret == NULL);
    __Pyx_Coroutine_Undelegate(gen);
    result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
    Py_XDECREF(ret);
    return result;
}
#endif
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
}
static __Pyx_PySendResult
__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
    __Pyx_PySendResult result;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
      #if !CYTHON_USE_AM_SEND
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
      #endif
        {
            #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
            if (value == Py_None && PyIter_Check(yf))
                ret = __Pyx_PyIter_Next_Plain(yf);
            else
            #endif
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
        }
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            *retval = ret;
            return PYGEN_NEXT;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return result;
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    CYTHON_UNUSED_VAR(gen);
    assert(__Pyx_Coroutine_get_is_running(gen));
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    #endif
    {
        PyObject *meth;
        result = PYGEN_RETURN;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval)) {
                result = PYGEN_ERROR;
            }
        }
    }
    Py_XDECREF(retval);
    return result == PYGEN_ERROR ? -1 : 0;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
            ret = __Pyx_PyIter_Next_Plain(yf);
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result;
    CYTHON_UNUSED_VAR(arg);
    result = __Pyx_Coroutine_Close(self, &retval);
    if (unlikely(result == PYGEN_ERROR))
        return NULL;
    Py_XDECREF(retval);
    Py_RETURN_NONE;
}
static __Pyx_PySendResult
__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PySendResult result;
    PyObject *yf;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    yf = gen->yieldfrom;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
    if (result == PYGEN_ERROR) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_Coroutine_unset_is_running(gen);
        if (!__Pyx_PyErr_Occurred()) {
            return PYGEN_RETURN;
        } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
            __Pyx_PyErr_Clear();
            return PYGEN_RETURN;
        }
        return PYGEN_ERROR;
    } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_RETURN;
    } else {
        const char *msg;
        Py_DECREF(*retval);
        *retval = NULL;
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
            msg = "async generator ignored GeneratorExit";
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_ERROR;
    }
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    yf = gen->yieldfrom;
    if (yf) {
        __Pyx_PySendResult result;
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                goto propagate_exception;
            goto throw_here;
        }
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    __Pyx_Coroutine_unset_is_running(gen);
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                goto throw_here;
            }
            if (likely(args)) {
                ret = __Pyx_PyObject_Call(meth, args, NULL);
            } else {
                PyObject *cargs[4] = {NULL, typ, val, tb};
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
            }
            Py_DECREF(meth);
        }
        Py_DECREF(yf);
        if (ret) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
propagate_exception:
    {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
    }
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_VISIT(exc_state->exc_value);
#else
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
#endif
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    {
        int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    if (gen->gi_weakreflist != NULL)
    #endif
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        {
            destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
            if (del) del(self);
        }
        if (unlikely(Py_REFCNT(self) > 0))
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    __Pyx_PyHeapTypeObject_GC_Del(gen);
}
#if CYTHON_USE_TP_FINALIZE
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
        if (result == PYGEN_ERROR) {
            PyErr_WriteUnraisable(self);
        } else {
            Py_XDECREF(retval);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
}
#endif
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_name;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_name, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_qualname;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
static PyObject *
__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
{
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyObject *frame;
    #if PY_VERSION_HEX >= 0x030d0000
    Py_BEGIN_CRITICAL_SECTION(self);
    #endif
    frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        PyObject *globals = PyDict_New();
        if (unlikely(!globals)) return NULL;
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            globals,                        /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        Py_DECREF(globals);
        if (unlikely(!frame))
            return NULL;
        if (unlikely(self->gi_frame)) {
            Py_DECREF(frame);
            frame = self->gi_frame;
        } else {
            self->gi_frame = frame;
        }
    }
    Py_INCREF(frame);
    #if PY_VERSION_HEX >= 0x030d0000
    Py_END_CRITICAL_SECTION();
    #endif
    return frame;
#else
    CYTHON_UNUSED_VAR(self);
    Py_RETURN_NONE;
#endif
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
    CYTHON_UNUSED_VAR(context);
    PyObject *frame = self->gi_frame;
    if (frame)
        return __Pyx_NewRef(frame);
    return __Pyx__Coroutine_get_frame(self);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->yieldfrom_am_send = NULL;
    #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_exc_state.exc_value = NULL;
    #else
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
    #endif
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_weakreflist = NULL;
#endif
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    gen->is_running = 1;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    assert(gen->is_running);
    gen->is_running = 0;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
}
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
    CYTHON_UNUSED_VAR(closure);
    char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
    if (result) Py_RETURN_TRUE;
    else Py_RETURN_FALSE;
}
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
    Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
    if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
        return;
    }
    memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
    static_amsend_methods->am_send = am_send;
    type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
}
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
    PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
                         self_type_name);
    __Pyx_DECREF_TypeName(self_type_name);
    return NULL;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     PyDoc_STR("object being iterated by 'yield from', or None")},
    {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     PyDoc_STR("name of the generator"), 0},
    {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     PyDoc_STR("qualified name of the generator"), 0},
    {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     PyDoc_STR("Frame of the generator"), 0},
    {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_GeneratorType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_iter, (void *)PyObject_SelfIter},
    {Py_tp_iternext, (void *)__Pyx_Generator_Next},
    {Py_tp_methods, (void *)__pyx_Generator_methods},
    {Py_tp_members, (void *)__pyx_Generator_memberlist},
    {Py_tp_getset, (void *)__pyx_Generator_getsets},
    {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_WEAKREF |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_GeneratorType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2
static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
#endif
static int __pyx_Generator_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
    if (unlikely(!mstate->__pyx_GeneratorType)) {
        return -1;
    }
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
#endif
    return 0;
}
static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *retval = NULL;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    __Pyx_Coroutine_unset_is_running(gen);
    (void) result;
    assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
    assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
    return retval;
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
    const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
    if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
        return 0;
    if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
        return 1;
    {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compile time Python version %d.%d "
                      "of module '%.100s' "
                      "%s "
                      "runtime version %d.%d",
                       (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                       __Pyx_MODULE_NAME,
                       (allow_newer) ? "was newer than" : "does not match",
                       (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
       );
        return PyErr_WarnEx(NULL, message, 1);
    }
}

/* NewCodeObj */
#if CYTHON_COMPILING_IN_LIMITED_API
    static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                       PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                       PyObject *fv, PyObject *cell, PyObject* fn,
                                       PyObject *name, int fline, PyObject *lnos) {
        PyObject *exception_table = NULL;
        PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
        #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
        PyObject *version_info;
        PyObject *py_minor_version = NULL;
        #endif
        long minor_version = 0;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
        minor_version = 11;
        #else
        if (!(version_info = PySys_GetObject("version_info"))) goto end;
        if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
        minor_version = PyLong_AsLong(py_minor_version);
        Py_DECREF(py_minor_version);
        if (minor_version == -1 && PyErr_Occurred()) goto end;
        #endif
        if (!(types_module = PyImport_ImportModule("types"))) goto end;
        if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
        if (minor_version <= 7) {
            (void)p;
            result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else if (minor_version <= 10) {
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else {
            if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
        }
    end:
        Py_XDECREF(code_type);
        Py_XDECREF(exception_table);
        Py_XDECREF(types_module);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return result;
    }
#elif PY_VERSION_HEX >= 0x030B0000
  static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                         PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                         PyObject *fv, PyObject *cell, PyObject* fn,
                                         PyObject *name, int fline, PyObject *lnos) {
    PyCodeObject *result;
    result =
      #if PY_VERSION_HEX >= 0x030C0000
        PyUnstable_Code_NewWithPosOnlyArgs
      #else
        PyCode_NewWithPosOnlyArgs
      #endif
        (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
    if (likely(result))
        result->_co_firsttraceable = 0;
    #endif
    return result;
  }
#elif !CYTHON_COMPILING_IN_PYPY
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
) {
    PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
    Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
    PyObject *varnames_tuple = PyTuple_New(var_count);
    if (unlikely(!varnames_tuple)) return NULL;
    for (Py_ssize_t i=0; i < var_count; i++) {
        Py_INCREF(varnames[i]);
        if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
    }
    #if CYTHON_COMPILING_IN_LIMITED_API
    varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
    if (!varnames_tuple_dedup) {
        if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
        varnames_tuple_dedup = varnames_tuple;
    }
    #else
    varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
    if (unlikely(!varnames_tuple_dedup)) goto done;
    #endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(varnames_tuple_dedup);
    #endif
    if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
        Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(line_table_length == -1)) goto done;
        #endif
        Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
        code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
        if (unlikely(!code_bytes)) goto done;
        char* c_code_bytes = PyBytes_AsString(code_bytes);
        if (unlikely(!c_code_bytes)) goto done;
        memset(c_code_bytes, 0, (size_t) code_len);
    }
    code_obj = (PyObject*) __Pyx__PyCode_New(
        (int) descr.argcount,
        (int) descr.num_posonly_args,
        (int) descr.num_kwonly_args,
        (int) descr.nlocals,
        0,
        (int) descr.flags,
        code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        varnames_tuple_dedup,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        filename,
        funcname,
        (int) descr.first_line,
        (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
    );
done:
    Py_XDECREF(code_bytes);
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(varnames_tuple_dedup);
    #endif
    Py_DECREF(varnames_tuple);
    return code_obj;
}

/* DecompressString */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
    PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
    const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
    PyObject *methodname = PyUnicode_FromString("decompress");
    if (unlikely(!methodname)) return NULL;
    #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
    if (algo == 3) {
        PyObject *fromlist = Py_BuildValue("[O]", methodname);
        if (unlikely(!fromlist)) goto bad;
        module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
    } else
    #endif
        module = PyImport_ImportModule(module_name);
    if (unlikely(!module)) goto import_failed;
    decompress = PyObject_GetAttr(module, methodname);
    if (unlikely(!decompress)) goto import_failed;
    {
        #ifdef __cplusplus
            char *memview_bytes = const_cast<char*>(s);
        #else
            #if defined(__clang__)
              #pragma clang diagnostic push
              #pragma clang diagnostic ignored "-Wcast-qual"
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic push
              #pragma GCC diagnostic ignored "-Wcast-qual"
            #endif
            char *memview_bytes = (char*) s;
            #if defined(__clang__)
              #pragma clang diagnostic pop
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic pop
            #endif
        #endif
        #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
        int memview_flags = 0x100;
        #else
        int memview_flags = PyBUF_READ;
        #endif
        compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
    }
    if (unlikely(!compressed_bytes)) {
        Py_DECREF(decompress);
        goto bad;
    }
    decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
    Py_DECREF(compressed_bytes);
    Py_DECREF(decompress);
    Py_DECREF(module);
    Py_DECREF(methodname);
    return decompressed;
import_failed:
    PyErr_Format(PyExc_ImportError,
        "Failed to import '%.20s.decompress' - cannot initialise module strings. "
        "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
        module_name, algo);
bad:
    Py_XDECREF(module);
    Py_DECREF(methodname);
    return NULL;
}

#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
}
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  else if (!PyErr_Occurred()) {
      PyErr_SetString(PyExc_TypeError,
                      "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return __Pyx_NewRef(b ? Py_True: Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


/* MultiPhaseInitModuleState */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
#else
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
#endif
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
#error "Module state with PEP489 requires atomics. Currently that's one of\
 C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
#endif
#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#define __Pyx_ModuleStateLookup_Lock()
#define __Pyx_ModuleStateLookup_Unlock()
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(__cplusplus) && __cplusplus >= 201103L
#include <mutex>
static std::mutex __Pyx_ModuleStateLookup_mutex;
#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
#include <threads.h>
static mtx_t __Pyx_ModuleStateLookup_mutex;
static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
    mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
}
#define __Pyx_ModuleStateLookup_Lock()\
  call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  mtx_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(HAVE_PTHREAD_H)
#include <pthread.h>
static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(_WIN32)
#include <Windows.h>  // synchapi.h on its own doesn't work
static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#else
#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
 Requires C standard >= C11, or C++ standard >= C++11,\
 or pthreads, or the Windows 32 API, or Python >= 3.13."
#endif
typedef struct {
    int64_t id;
    PyObject *module;
} __Pyx_InterpreterIdAndModule;
typedef struct {
    char interpreter_id_as_index;
    Py_ssize_t count;
    Py_ssize_t allocated;
    __Pyx_InterpreterIdAndModule table[1];
} __Pyx_ModuleStateLookupData;
#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
#else
static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
#endif
static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
        __Pyx_InterpreterIdAndModule* table,
        Py_ssize_t count,
        int64_t interpreterId) {
    __Pyx_InterpreterIdAndModule* begin = table;
    __Pyx_InterpreterIdAndModule* end = begin + count;
    if (begin->id == interpreterId) {
        return begin;
    }
    while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
        __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
        if (halfway->id == interpreterId) {
            return halfway;
        }
        if (halfway->id < interpreterId) {
            begin = halfway;
        } else {
            end = halfway;
        }
    }
    for (; begin < end; ++begin) {
        if (begin->id >= interpreterId) return begin;
    }
    return begin;
}
static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return NULL;
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
    {
        __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        if (likely(data)) {
            __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
            if (likely(data == new_data)) {
                goto read_finished;
            }
        }
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        __Pyx_ModuleStateLookup_Lock();
        __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
        data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
        __Pyx_ModuleStateLookup_Unlock();
    }
  read_finished:;
#else
    __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_InterpreterIdAndModule* found = NULL;
    if (unlikely(!data)) goto end;
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            found = data->table+interpreter_id;
        }
    } else {
        found = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
    }
  end:
    {
        PyObject *result=NULL;
        if (found && found->id == interpreter_id) {
            result = found->module;
        }
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
#endif
        return result;
    }
}
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
    while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
}
#else
#define __Pyx_ModuleStateLookup_wait_until_no_readers()
#endif
static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
    Py_ssize_t to_allocate = (*old_data)->allocated;
    while (to_allocate <= interpreter_id) {
        if (to_allocate == 0) to_allocate = 1;
        else to_allocate *= 2;
    }
    __Pyx_ModuleStateLookupData *new_data = *old_data;
    if (to_allocate != (*old_data)->allocated) {
         new_data = (__Pyx_ModuleStateLookupData *)realloc(
            *old_data,
            sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
        if (!new_data) {
            PyErr_NoMemory();
            return -1;
        }
        for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
            new_data->table[i].id = i;
            new_data->table[i].module = NULL;
        }
        new_data->allocated = to_allocate;
    }
    new_data->table[interpreter_id].module = module;
    if (new_data->count < interpreter_id+1) {
        new_data->count = interpreter_id+1;
    }
    *old_data = new_data;
    return 0;
}
static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
    __Pyx_InterpreterIdAndModule *read = data->table;
    __Pyx_InterpreterIdAndModule *write = data->table;
    __Pyx_InterpreterIdAndModule *end = read + data->count;
    for (; read<end; ++read) {
        if (read->module) {
            write->id = read->id;
            write->module = read->module;
            ++write;
        }
    }
    data->count = write - data->table;
    for (; write<end; ++write) {
        write->id = 0;
        write->module = NULL;
    }
    data->interpreter_id_as_index = 0;
}
static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    int result = 0;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_ModuleStateLookupData *new_data = old_data;
    if (!new_data) {
        new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
        if (!new_data) {
            result = -1;
            PyErr_NoMemory();
            goto end;
        }
        new_data->allocated = 1;
        new_data->interpreter_id_as_index = 1;
    }
    __Pyx_ModuleStateLookup_wait_until_no_readers();
    if (new_data->interpreter_id_as_index) {
        if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
            result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
            goto end;
        }
        __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
    }
    {
        Py_ssize_t insert_at = 0;
        {
            __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                new_data->table, new_data->count, interpreter_id);
            assert(lower_bound);
            insert_at = lower_bound - new_data->table;
            if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                lower_bound->module = module;
                goto end;  // already in table, nothing more to do
            }
        }
        if (new_data->count+1 >= new_data->allocated) {
            Py_ssize_t to_allocate = (new_data->count+1)*2;
            new_data =
                (__Pyx_ModuleStateLookupData*)realloc(
                    new_data,
                    sizeof(__Pyx_ModuleStateLookupData) +
                    (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
            if (!new_data) {
                result = -1;
                new_data = old_data;
                PyErr_NoMemory();
                goto end;
            }
            new_data->allocated = to_allocate;
        }
        ++new_data->count;
        int64_t last_id = interpreter_id;
        PyObject *last_module = module;
        for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
            int64_t current_id = new_data->table[i].id;
            new_data->table[i].id = last_id;
            last_id = current_id;
            PyObject *current_module = new_data->table[i].module;
            new_data->table[i].module = last_module;
            last_module = current_module;
        }
    }
  end:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
#else
    __Pyx_ModuleStateLookup_data = new_data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return result;
}
static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
#endif
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            data->table[interpreter_id].module = NULL;
        }
        goto done;
    }
    {
        __Pyx_ModuleStateLookup_wait_until_no_readers();
        __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
        if (!lower_bound) goto done;
        if (lower_bound->id != interpreter_id) goto done;
        __Pyx_InterpreterIdAndModule *end = data->table+data->count;
        for (;lower_bound<end-1; ++lower_bound) {
            lower_bound->id = (lower_bound+1)->id;
            lower_bound->module = (lower_bound+1)->module;
        }
    }
    --data->count;
    if (data->count == 0) {
        free(data);
        data = NULL;
    }
  done:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
#else
    __Pyx_ModuleStateLookup_data = data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return 0;
}
#endif

/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
