xpra icon
Bug tracker and wiki

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


Ticket #1735: notifyicon-merge.patch

File notifyicon-merge.patch, 1.6 KB (added by Antoine Martin, 3 years ago)

switching to the other ctypes implementation does not work: the structures are not equivallent

  • xpra/platform/win32/win32_balloon.py

     
    101101
    102102
    103103def notify(hwnd, app_id, title, message, timeout=5000, icon=None):
    104     nid = PyNOTIFYICONDATA()
     104    from xpra.platform.win32.win32_NotifyIcon import NOTIFYICONDATA, Shell_NotifyIcon
     105    from xpra.platform.win32.common import GUID
     106    from xpra.util import XPRA_GUID1, XPRA_GUID2, XPRA_GUID3, XPRA_GUID4
     107    from ctypes import sizeof
     108    nid = NOTIFYICONDATA()
     109    nid.cbSize = sizeof(NOTIFYICONDATA)
    105110    nid.hWnd = hwnd
    106111    nid.uID = app_id
    107112    nid.uFlags = NIF_INFO
    108     nid.guidItem = XPRA_GUID_BYTES
    109     nid.szInfo = chop_string(message, 255, False)        #prevent overflow
    110     nid.szInfoTitle = chop_string(title, 63)
     113    guid = GUID()
     114    guid.Data1 = XPRA_GUID1
     115    guid.Data2 = XPRA_GUID2
     116    guid.Data3 = XPRA_GUID3
     117    guid.Data4 = XPRA_GUID4
     118    nid.guidItem = guid
     119    nid.szInfo = chop_string(message, 255, False).decode()        #prevent overflow
     120    nid.szInfoTitle = chop_string(title, 63).decode()
    111121    if timeout<=0:
    112122        timeout = 5000
    113123    nid.uTimeoutOrVersion = timeout
     
    135145            log.error(" %s", e)
    136146        else:
    137147            nid.dwInfoFlags = NIIF_USER
    138     Shell_NotifyIcon = windll.shell32.Shell_NotifyIcon
    139     Shell_NotifyIcon(NIM_MODIFY, nid.pack())
     148    #Shell_NotifyIcon = windll.shell32.Shell_NotifyIcon
     149    Shell_NotifyIcon(NIM_MODIFY, nid)
    140150
    141151
    142152def main():