Index: trunk/src/shell32/makefile
===================================================================
--- trunk/src/shell32/makefile	(revision 21590)
+++ trunk/src/shell32/makefile	(revision 21591)
@@ -68,4 +68,5 @@
 $(OBJDIR)\systray.obj \
 $(OBJDIR)\systray_os2.obj \
+$(OBJDIR)\systray_os2ex.obj \
 !if "$(DEBUG)" == "1"
 $(OBJDIR)\dbgwrap.obj \
Index: trunk/src/shell32/systray.c
===================================================================
--- trunk/src/shell32/systray.c	(revision 21590)
+++ trunk/src/shell32/systray.c	(revision 21591)
@@ -28,23 +28,23 @@
 #include "winuser32.h"
 
+#include "systray.h"
+
 DEFAULT_DEBUG_CHANNEL(shell);
 
 
-
-typedef struct SystrayItem {
+struct _SystrayItem {
   HWND                  hWnd;
   HWND                  hWndToolTip;
   NOTIFYICONDATAA       notifyIcon;
-  struct SystrayItem    *nextTrayItem;
-} SystrayItem;
+  struct _SystrayItem   *nextTrayItem;
+};
 
 static SystrayItem *systray=NULL;
-static int firstSystray=TRUE; /* defer creation of window class until first systray item is created */
 
-BOOL SYSTRAY_ItemInit(SystrayItem *ptrayItem);
-void SYSTRAY_ItemTerm(SystrayItem *ptrayItem);
-void SYSTRAY_ItemSetMessage(SystrayItem *ptrayItem, ULONG uCallbackMessage);
-void SYSTRAY_ItemSetIcon(SystrayItem *ptrayItem, HICON hIcon);
-void SYSTRAY_ItemSetTip(SystrayItem *ptrayItem, CHAR* szTip, int modify);
+BOOL (*SYSTRAY_ItemInit)(SystrayItem *ptrayItem) = 0;
+void (*SYSTRAY_ItemTerm)(SystrayItem *ptrayItem) = 0;
+void (*SYSTRAY_ItemSetMessage)(SystrayItem *ptrayItem, ULONG uCallbackMessage) = 0;
+void (*SYSTRAY_ItemSetIcon)(SystrayItem *ptrayItem, HICON hIcon) = 0;
+void (*SYSTRAY_ItemSetTip)(SystrayItem *ptrayItem, CHAR* szTip, int modify) = 0;
 
 
@@ -129,4 +129,5 @@
 }
 
+#ifndef __WIN32OS2__
 /*************************************************************************
  *
@@ -136,4 +137,5 @@
   return TRUE;
 }
+#endif
 
 /*************************************************************************
Index: trunk/src/shell32/systray.h
===================================================================
--- trunk/src/shell32/systray.h	(revision 21591)
+++ trunk/src/shell32/systray.h	(revision 21591)
@@ -0,0 +1,20 @@
+/*
+ *  Systray.
+ *
+ *  Common definitions.
+ */
+
+#ifndef __WINE_SYSTRAY_H
+#define __WINE_SYSTRAY_H
+
+struct _SystrayItem;
+
+typedef struct _SystrayItem SystrayItem;
+
+BOOL (*SYSTRAY_ItemInit)(SystrayItem *ptrayItem);
+void (*SYSTRAY_ItemTerm)(SystrayItem *ptrayItem);
+void (*SYSTRAY_ItemSetMessage)(SystrayItem *ptrayItem, ULONG uCallbackMessage);
+void (*SYSTRAY_ItemSetIcon)(SystrayItem *ptrayItem, HICON hIcon);
+void (*SYSTRAY_ItemSetTip)(SystrayItem *ptrayItem, CHAR* szTip, int modify);
+
+#endif // __WINE_SYSTRAY_H
Index: trunk/src/shell32/systray_os2.c
===================================================================
--- trunk/src/shell32/systray_os2.c	(revision 21590)
+++ trunk/src/shell32/systray_os2.c	(revision 21591)
@@ -6,8 +6,5 @@
  *  date: 1 May 2004
  *
- *  Notes: what's about HAB at lines 113, 118 ?
- *
  */
-
 
 #define  INCL_WIN
@@ -19,4 +16,5 @@
 #include <winconst.h>
 
+#include "systray_os2.h"
 
 #define WM_TRAYADDME (WM_USER+1)
@@ -28,33 +26,7 @@
 #define SZTOPIC     "TRAY"
 
-
-BOOL DoWin32PostMessage(HWND, ULONG, MPARAM, MPARAM);
-BOOL DoWin32CharToOem(const char *s, char *t);
-
 static HWND hwndTrayServer = 0;
 
-
-typedef struct _NOTIFYICONDATAA
-{   ULONG    cbSize;
-    HWND     hWnd;
-    ULONG    uID;
-    ULONG    uFlags;
-    ULONG    uCallbackMessage;
-    HPOINTER hIcon;
-    CHAR     szTip[64];
-} NOTIFYICONDATAA, *PNOTIFYICONDATAA;
-
-
-typedef struct SystrayItem {
-  HWND                  hWndFrame;
-  HWND                  hWndClient;
-  NOTIFYICONDATAA       notifyIcon;
-  struct SystrayItem    *nextTrayItem;
-} SystrayItem;
-
-
-
-
-static MRESULT EXPENTRY SYSTRAY_WndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
+static MRESULT EXPENTRY SYSTRAY_Old_WndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
     SystrayItem *ptrayItem = (SystrayItem *)WinQueryWindowULong(hWnd, QWL_USER);
@@ -111,20 +83,19 @@
 }
 
-//extern HAB hab;
-const char * const systraysupclass = "Odin32SystraySupport";
+static const char * const systraysupclass = "Odin32SystraySupport";
 
-BOOL SYSTRAY_RegisterClass(void)
+static BOOL SYSTRAY_Old_RegisterClass(void)
 {
-    //WinRegisterClass( hab, systraysupclass, SYSTRAY_WndProc, 0, sizeof(ULONG) );
-    WinRegisterClass(0, systraysupclass, SYSTRAY_WndProc, 0, sizeof(ULONG) );
+    //WinRegisterClass( hab, systraysupclass, SYSTRAY_Old_WndProc, 0, sizeof(ULONG) );
+    WinRegisterClass(0, systraysupclass, SYSTRAY_Old_WndProc, 0, sizeof(ULONG) );
     return TRUE;
 }
 
 
-BOOL SYSTRAY_ItemInit(SystrayItem *ptrayItem)
+static BOOL SYSTRAY_Old_ItemInit(SystrayItem *ptrayItem)
 {
     ULONG fcf = FCF_TITLEBAR;
 
-    if ( !SYSTRAY_RegisterClass() )
+    if ( !SYSTRAY_Old_RegisterClass() )
     {
         return FALSE;
@@ -152,5 +123,5 @@
 }
 
-void SYSTRAY_ItemTerm(SystrayItem *ptrayItem)
+static void SYSTRAY_Old_ItemTerm(SystrayItem *ptrayItem)
 {
     HPOINTER hIcon = (HPOINTER)WinSendMsg(ptrayItem->hWndFrame, WM_QUERYICON, NULL, NULL);
@@ -162,5 +133,5 @@
 
 
-void SYSTRAY_ItemSetMessage(SystrayItem *ptrayItem, ULONG uCallbackMessage)
+static void SYSTRAY_Old_ItemSetMessage(SystrayItem *ptrayItem, ULONG uCallbackMessage)
 {
   ptrayItem->notifyIcon.uCallbackMessage = uCallbackMessage;
@@ -168,5 +139,5 @@
 
 
-void SYSTRAY_ItemSetIcon(SystrayItem *ptrayItem, HPOINTER hIcon)
+static void SYSTRAY_Old_ItemSetIcon(SystrayItem *ptrayItem, HPOINTER hIcon)
 {
     // Windows seems to make a copy of icons displayed in the tray area. At
@@ -174,5 +145,5 @@
     // Shell_NotifyIcon() doesn't harm the icon displayed in the tray. Behave
     // similarly on OS/2 (some applications do call DestroyIcon()). The copy is
-    // deleted in SYSTRAY_ItemTerm().
+    // deleted in SYSTRAY_Old_ItemTerm().
 
     POINTERINFO Info;
@@ -193,5 +164,5 @@
 
 
-void SYSTRAY_ItemSetTip(SystrayItem *ptrayItem, CHAR* szTip, int modify)
+static void SYSTRAY_Old_ItemSetTip(SystrayItem *ptrayItem, CHAR* szTip, int modify)
 {
 	char tmp[ 64 ];
@@ -204,2 +175,19 @@
 }
 
+
+BOOL SYSTRAY_Init(void)
+{
+    // try the new xsystray API first
+    if (SYSTRAY_Ex_Init())
+        return TRUE;
+
+    // fallback to the old API
+    SYSTRAY_ItemInit = SYSTRAY_Old_ItemInit;
+    SYSTRAY_ItemTerm = SYSTRAY_Old_ItemTerm;
+    SYSTRAY_ItemSetMessage = SYSTRAY_Old_ItemSetMessage;
+    SYSTRAY_ItemSetIcon = SYSTRAY_Old_ItemSetIcon;
+    SYSTRAY_ItemSetTip = SYSTRAY_Old_ItemSetTip;
+
+    return TRUE;
+}
+
Index: trunk/src/shell32/systray_os2.h
===================================================================
--- trunk/src/shell32/systray_os2.h	(revision 21591)
+++ trunk/src/shell32/systray_os2.h	(revision 21591)
@@ -0,0 +1,42 @@
+/*
+ *  OS/2 System Tray support.
+ *
+ *  Common definitions.
+ */
+
+#ifndef __WINE_SYSTRAY_OS2_H
+#define __WINE_SYSTRAY_OS2_H
+
+// map some Win32 types used in systray.h to OS/2 types
+// to avoid Win32 header inclusion and conflicts
+
+#define HICON HPOINTER
+
+#include "systray.h"
+
+// define some Win32 structs in terms of OS/2 types
+// to avoid Win32 header inclusion and conflicts
+
+typedef struct _NOTIFYICONDATAA
+{   ULONG    cbSize;
+    HWND     hWnd;
+    ULONG    uID;
+    ULONG    uFlags;
+    ULONG    uCallbackMessage;
+    HPOINTER hIcon;
+    CHAR     szTip[64];
+} NOTIFYICONDATAA, *PNOTIFYICONDATAA;
+
+struct _SystrayItem {
+  HWND                  hWndFrame;
+  HWND                  hWndClient;
+  NOTIFYICONDATAA       notifyIcon;
+  struct _SystrayItem   *nextTrayItem;
+};
+
+BOOL DoWin32PostMessage(HWND, ULONG, MPARAM, MPARAM);
+BOOL DoWin32CharToOem(const char *s, char *t);
+
+BOOL SYSTRAY_Ex_Init(void);
+
+#endif // __WINE_SYSTRAY_OS2_H
Index: trunk/src/shell32/systray_os2ex.c
===================================================================
--- trunk/src/shell32/systray_os2ex.c	(revision 21591)
+++ trunk/src/shell32/systray_os2ex.c	(revision 21591)
@@ -0,0 +1,60 @@
+/*
+ *  OS/2 System Tray support.
+ *  A better implementaiton using the xsystray XCenter/eCenter widget API.
+ *
+ *  Author: Dmitriy Kuminov
+ */
+
+#define  INCL_WIN
+#include <os2wrap.h>
+
+#include <string.h>
+
+#include <odin.h>
+#include <winconst.h>
+
+//@todo later
+//#include <xsystray_api.h>
+
+#include "systray_os2.h"
+
+static BOOL SYSTRAY_Ex_ItemInit(SystrayItem *ptrayItem)
+{
+    //@todo later
+    return TRUE;
+}
+
+static void SYSTRAY_Ex_ItemTerm(SystrayItem *ptrayItem)
+{
+    //@todo later
+
+}
+
+static void SYSTRAY_Ex_ItemSetMessage(SystrayItem *ptrayItem, ULONG uCallbackMessage)
+{
+    //@todo later
+
+}
+
+static void SYSTRAY_Ex_ItemSetIcon(SystrayItem *ptrayItem, HPOINTER hIcon)
+{
+    //@todo later
+
+}
+
+static void SYSTRAY_Ex_ItemSetTip(SystrayItem *ptrayItem, CHAR* szTip, int modify)
+{
+    //@todo later
+}
+
+BOOL SYSTRAY_Ex_Init(void)
+{
+    SYSTRAY_ItemInit = SYSTRAY_Ex_ItemInit;
+    SYSTRAY_ItemTerm = SYSTRAY_Ex_ItemTerm;
+    SYSTRAY_ItemSetMessage = SYSTRAY_Ex_ItemSetMessage;
+    SYSTRAY_ItemSetIcon = SYSTRAY_Ex_ItemSetIcon;
+    SYSTRAY_ItemSetTip = SYSTRAY_Ex_ItemSetTip;
+
+    return TRUE;
+}
+
