Ignore:
Timestamp:
Oct 27, 2009, 2:36:55 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: xsystray: Further coding (established communication channel between the clients and the server, some bug fixes).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/3rdparty/os2/xsystray/xsystray_api.c

    r255 r256  
    2727
    2828static HWND G_hwndSysTray = NULLHANDLE;
    29 static int G_itlsSysTrayMsgData = -1;
     29static int G_itlsSysTrayData = -1;
    3030
    3131static HWND FindSysTrayWindow()
     
    4646}
    4747
    48 static BOOL SendSysTrayCtlMsg(PSYSTRAYMSGDATA pData)
     48static BOOL SendSysTrayCtlMsg(PSYSTRAYDATA pData)
    4949{
    5050    APIRET arc;
     
    7070            arc = ERROR_INVALID_HANDLE;
    7171            if (WinQueryWindowProcess(G_hwndSysTray, &pid, &tid))
    72                 arc = DosGiveSharedMem(__libc_TLSGet(G_itlsSysTrayMsgData),
     72                arc = DosGiveSharedMem(__libc_TLSGet(G_itlsSysTrayData),
    7373                                       pid, PAG_READ | PAG_WRITE);
    7474            if (arc != NO_ERROR)
     
    8080        mrc = WinSendMsg(G_hwndSysTray, WM_XST_CONTROL, pData, NULL);
    8181        if (mrc == (MRESULT)TRUE && pData->bAcknowledged)
    82             break;
     82            ;
    8383
    8484        // if we failed to send the message, it may mean that XCenter was restarted
     
    9898}
    9999
    100 static PSYSTRAYMSGDATA GetSysTrayMsgDataPtr()
     100static PSYSTRAYDataPtr()
    101101{
    102102    APIRET arc;
    103103
    104104    // allocate a thread local storage entry if not done so
    105     if (G_itlsSysTrayMsgData == -1)
     105    if (G_itlsSysTrayData == -1)
    106106    {
    107107        // @todo does XWorkplace have its own TLS? Not? Use
     
    109109        // to the lack of space in that area)
    110110        int itls = __libc_TLSAlloc();
    111         if (!__atomic_cmpxchg32(&G_itlsSysTrayMsgData, itls, -1))
     111        if (!__atomic_cmpxchg32(&G_itlsSysTrayData, itls, -1))
    112112        {
    113113            // another thread has already got an entry, discard our try
     
    116116        }
    117117
    118         if (G_itlsSysTrayMsgData == -1)
     118        if (G_itlsSysTrayData == -1)
    119119            return NULL;
    120120    }
    121121
    122     // allocate a SYSTRAYMSGDATA struct for this thread if not done so
    123     PSYSTRAYMSGDATA pData = __libc_TLSGet(G_itlsSysTrayMsgData);
    124     if (!pData)
    125     {
    126         arc = DosAllocSharedMem((PVOID)&pData, NULL, sizeof(SYSTRAYMSGDATA),
     122    // allocate a SYSTRAYDATA struct for this thread if not done so
     123    PSYSTRAYData);
     124    if (!pData)
     125    {
     126        arc = DosAllocSharedMem((PVOID)&pData, NULL, sizeof(SYSTRAYDATA),
    127127                                PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE);
    128128        if (arc != NO_ERROR)
    129129            return NULL;
    130130
    131         __libc_TLSSet(G_itlsSysTrayMsgData, pData);
     131        __libc_TLSSet(G_itlsSysTrayData, pData);
    132132
    133133        // note that we don't ever free the allocated block since our API doesn't
     
    159159                            PULONG pulRevision) // out: revision number
    160160{
    161     PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
     161    PSYSTRAYDataPtr();
    162162    if (!pData)
    163163        return FALSE;
     
    166166    pData->hwndSender = NULLHANDLE;
    167167
    168     BOOL rc = SendSysTrayCtlMsg(pData);
    169     if (rc)
     168    BOOL rc = SendSysTrayCtlMsg(pData);
     169    if (rc)
    170170    {
    171171        if (pulMajor)
     
    177177    }
    178178
    179     return rc;
     179    return rc;
    180180}
    181181
     
    215215                       ULONG ulFlags)   // in: flags (not currently used, must be 0)
    216216{
    217     PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
     217    PSYSTRAYDataPtr();
    218218    if (!pData)
    219219        return FALSE;
     
    240240                          ULONG ulId)   // in: icon ID to remove
    241241{
    242     PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
     242    PSYSTRAYDataPtr();
    243243    if (!pData)
    244244        return FALSE;
     
    272272                              PSZ pszText)  // in: tooltip text
    273273{
    274     PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
     274    PSYSTRAYDataPtr();
    275275    if (!pData)
    276276        return FALSE;
     
    361361ULONG xstGetSysTrayMaxTextLen()
    362362{
    363     return sizeof(((PSYSTRAYMSGDATA)0)->u.tooltip.szText);
    364 }
    365 
     363    return sizeof(((PSYSTRAYDATA)0)->u.tooltip.szText);
     364}
     365
Note: See TracChangeset for help on using the changeset viewer.