xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #678: shell32.patch

File shell32.patch, 2.8 KB (added by Antoine Martin, 4 years ago)

use cython to access shell functions

  • setup.py

     
    21212121toggle_packages(client_ENABLED and (gtk2_ENABLED or gtk3_ENABLED), "xpra.client.gtk_base")
    21222122toggle_packages(client_ENABLED and opengl_ENABLED and gtk2_ENABLED, "xpra.client.gl.gtk2")
    21232123toggle_packages(client_ENABLED and opengl_ENABLED and gtk3_ENABLED, "xpra.client.gl.gtk3")
     2124if client_ENABLED and WIN32 and MINGW_PREFIX:
     2125    shell32_pkgconfig = pkgconfig()
     2126    #build for Windows 7 or later:
     2127    add_to_keywords(shell32_pkgconfig, 'extra_compile_args', "-DNTDDI_VERSION=0x06010000")
     2128    #add_to_keywords(shell32_pkgconfig, 'extra_link_args', "-lshell32")
     2129    cython_add(Extension("xpra.platform.win32.shell32",
     2130                ["xpra/platform/win32/shell32.pyx"],
     2131                **shell32_pkgconfig))
     2132
    21242133if client_ENABLED or server_ENABLED:
    21252134    add_modules("xpra.codecs")
    21262135toggle_packages(client_ENABLED or server_ENABLED, "xpra.keyboard")
  • xpra/platform/win32/shell32.pyx

     
     1# This file is part of Xpra.
     2# Copyright (C) 2017 Antoine Martin <antoine@devloop.org.uk>
     3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
     4# later version. See the file COPYING for details.
     5
     6import struct
     7from xpra.log import Logger
     8log = Logger("win32")
     9
     10ctypedef long HRESULT
     11ctypedef long SHSTDAPI
     12ctypedef void* HWND
     13
     14ctypedef Py_UNICODE WCHAR
     15ctypedef const WCHAR* LPCOLESTR
     16
     17
     18cdef extern from "windows.h":
     19    pass
     20cdef extern from "guiddef.h":
     21    ctypedef struct GUID:
     22        pass
     23    ctypedef void* REFIID
     24    ctypedef void* LPCLSID
     25
     26cdef extern from "shlobj.h":
     27    SHSTDAPI SHCLSIDFromString(LPCOLESTR lpsz, LPCLSID pclsid)
     28cdef extern from "shobjidl.h":
     29    pass
     30    #GUID IID_IShellFolder
     31    #DEFINE_GUID (IID_IShellFolder, __MSABI_LONG(0x000214e6), 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46);
     32
     33cdef extern from "propkey.h":
     34    pass
     35cdef extern from "propvarutil.h":
     36    pass
     37cdef extern from "shellapi.h":
     38    SHSTDAPI SHGetPropertyStoreForWindow(HWND hwnd, REFIID riid, void **ppv)
     39
     40cdef extern from "propsys.h":
     41    ctypedef struct IPropertyStore:
     42        pass
     43
     44
     45def set_app_id(hwnd, app_id):
     46    log("set_app_id(%i, %i)", hwnd, app_id)
     47    cdef IPropertyStore *pps
     48    cdef HWND hWnd = <void *> hwnd
     49    #cdef GUID IID_IShellFolder
     50    cdef GUID IID_IShellFolder
     51    u16 = "{000214E6-0000-0000-C000-000000000046}".encode("utf16")
     52    SHCLSIDFromString(u16, &IID_IShellFolder);   
     53    #CLSIDFromString(u'{56FDF344-FD6D-11d0-958A-006097C9A090}', &IID_IShellFolder)
     54    cdef SHSTDAPI hr = SHGetPropertyStoreForWindow(hWnd, <REFIID> &IID_IShellFolder, <void **> &pps)