Changeset 21600 for trunk/src


Ignore:
Timestamp:
Mar 23, 2011, 5:52:24 PM (14 years ago)
Author:
dmik
Message:

shell32: systray: Fixed non-working systray notifications in modern Java apps by maintaining the xsystray proxy window on a dedicated thread that is never suspended by Java. Also added support for context menu (normally, RMB) notifications used in many Java applications.

Location:
trunk/src/shell32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/systray.c

    r21592 r21600  
    2727#include "config.h"
    2828#include "winuser32.h"
     29#include "auxthread.h"
    2930
    3031#include "systray.h"
     
    227228}
    228229
    229 /*************************************************************************
    230  * Shell_NotifyIconA            [SHELL32.297][SHELL32.296]
    231  */
    232 BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid )
    233 {
     230static PVOID Do_Shell_NotifyIconA(PVOID arg1, PVOID arg2,
     231                                  PVOID arg3, PVOID arg4)
     232{
     233    DWORD dwMessage = (DWORD)arg1;
     234    PNOTIFYICONDATAA pnid = (PNOTIFYICONDATAA)arg2;
     235
    234236    BOOL flag = FALSE;
    235237    switch(dwMessage)
     
    245247            break;
    246248    }
    247     return flag;
     249    return (PVOID)flag;
     250}
     251
     252/*************************************************************************
     253 * Shell_NotifyIconA            [SHELL32.297][SHELL32.296]
     254 */
     255BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid )
     256{
     257    PVOID ret;
     258    BOOL brc = RunOnAuxThreadAndWait(Do_Shell_NotifyIconA,
     259                                     (PVOID)dwMessage, (PVOID)pnid,
     260                                     NULL, NULL, &ret);
     261    if (brc)
     262        brc = (BOOL)ret;
     263    return brc;
    248264}
    249265
  • trunk/src/shell32/systray_os2.h

    r21592 r21600  
    88#define __WINE_SYSTRAY_OS2_H
    99
    10 // map some Win32 types used in systray.h to OS/2 types
    11 // to avoid Win32 header inclusion and conflicts
    12 
    13 #define HICON HPOINTER
    14 
    1510#include "systray.h"
    1611
    17 // define some Win32 structs in terms of OS/2 types
    18 // to avoid Win32 header inclusion and conflicts
     12// define some Win32 structs and types in terms of OS/2 types
     13// to avoid inclusion of shellapi.h that would create conflicts
    1914
    2015#define NIF_MESSAGE             0x00000001
  • trunk/src/shell32/systray_os2ex.c

    r21592 r21600  
    66 */
    77
    8 #define  INCL_WIN
    9 #define  INCL_DOS
    10 #define  INCL_DOSERRORS
    11 #include <os2wrap.h>
     8#define INCL_PM
     9#define INCL_DOS
     10#define INCL_DOSERRORS
     11#include <os2wrap.h> // Odin32 OS/2 api wrappers
     12
     13#include <win32api.h>
    1214
    1315#include <string.h>
    14 
    15 #include <odin.h>
    16 #include <winconst.h>
    1716
    1817// declare function pointers for dynamic linking to xsystray DLL
     
    2221#include "systray_os2.h"
    2322
     23#include "dbglog.h"
     24
    2425#define WM_XST_MYNOTIFY (WM_USER + 1000)
     26
     27static ULONG WM_XST_CREATED = 0;
    2528
    2629static HWND hwndProxy = NULLHANDLE;
     
    6972                                   (MPARAM)ptrayItem->notifyIcon.uID,
    7073                                   (MPARAM)winMsg);
     74                return (MRESULT)TRUE;
    7175            }
    72 
    73             return (MRESULT)FALSE;
     76            break;
     77        }
     78        case XST_IN_CONTEXT:
     79        {
     80            DoWin32PostMessage(ptrayItem->notifyIcon.hWnd,
     81                               ptrayItem->notifyIcon.uCallbackMessage,
     82                               (MPARAM)ptrayItem->notifyIcon.uID,
     83                               (MPARAM)WM_CONTEXTMENU_W);
     84            return (MRESULT)TRUE;
    7485        }
    7586        default:
    7687            break;
    7788        }
    78     }
    79 
     89
     90        return (MRESULT)FALSE;
     91    }
    8092    default:
     93    {
     94        if (msg == WM_XST_CREATED)
     95        {
     96            return (MRESULT)TRUE;
     97        }
    8198        break;
    8299    }
    83 
    84     return OldProxyWndProc(hWnd, msg, mp1, mp2);
     100    }
     101
     102    return WinDefWindowProc(hWnd, msg, mp1, mp2);
    85103}
    86104
     
    89107    if (hwndProxyRefs == 0)
    90108    {
    91         ULONG fcf = 0;
    92         hwndProxy = WinCreateStdWindow(HWND_DESKTOP, 0, &fcf, NULL,
    93                                        NULL, 0, NULLHANDLE, 0, NULL);
     109        if (!WinRegisterClass(NULLHANDLE, "OdinXSysTrayProxy", ProxyWndProc,
     110                              0, 0))
     111        {
     112            dprintf(("SHELL32: SYSTRAY: WinRegisterClass() failed with %x",
     113                     WinGetLastError(0)));
     114            return FALSE;
     115        }
     116
     117        hwndProxy = WinCreateWindow(HWND_DESKTOP, "OdinXSysTrayProxy", NULL,
     118                                    0, 0, 0, 0, 0, NULLHANDLE, HWND_BOTTOM, 0,
     119                                    NULL, NULL);
     120
    94121        if (hwndProxy == NULLHANDLE)
     122        {
     123            dprintf(("SHELL32: SYSTRAY: WinCreateWindow() failed with %x",
     124                     WinGetLastError(0)));
    95125            return FALSE;
    96 
    97         OldProxyWndProc = WinSubclassWindow(hwndProxy, ProxyWndProc);
    98     }
     126        }
     127    }
     128
    99129    ++ hwndProxyRefs;
    100130
     
    171201        return FALSE;
    172202
     203    // initialize some constants
     204    WM_XST_CREATED = xstGetSysTrayCreatedMsgId();
     205
    173206    SYSTRAY_ItemInit = SYSTRAY_Ex_ItemInit;
    174207    SYSTRAY_ItemTerm = SYSTRAY_Ex_ItemTerm;
Note: See TracChangeset for help on using the changeset viewer.