Ignore:
Timestamp:
Mar 16, 2011, 4:52:43 PM (14 years ago)
Author:
dmik
Message:

shell32: Prepared to the xsystray integration (keeping the old Systray/WPS based implementation).

File:
1 edited

Legend:

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

    r21590 r21591  
    66 *  date: 1 May 2004
    77 *
    8  *  Notes: what's about HAB at lines 113, 118 ?
    9  *
    108 */
    11 
    129
    1310#define  INCL_WIN
     
    1916#include <winconst.h>
    2017
     18#include "systray_os2.h"
    2119
    2220#define WM_TRAYADDME (WM_USER+1)
     
    2826#define SZTOPIC     "TRAY"
    2927
    30 
    31 BOOL DoWin32PostMessage(HWND, ULONG, MPARAM, MPARAM);
    32 BOOL DoWin32CharToOem(const char *s, char *t);
    33 
    3428static HWND hwndTrayServer = 0;
    3529
    36 
    37 typedef struct _NOTIFYICONDATAA
    38 {   ULONG    cbSize;
    39     HWND     hWnd;
    40     ULONG    uID;
    41     ULONG    uFlags;
    42     ULONG    uCallbackMessage;
    43     HPOINTER hIcon;
    44     CHAR     szTip[64];
    45 } NOTIFYICONDATAA, *PNOTIFYICONDATAA;
    46 
    47 
    48 typedef struct SystrayItem {
    49   HWND                  hWndFrame;
    50   HWND                  hWndClient;
    51   NOTIFYICONDATAA       notifyIcon;
    52   struct SystrayItem    *nextTrayItem;
    53 } SystrayItem;
    54 
    55 
    56 
    57 
    58 static MRESULT EXPENTRY SYSTRAY_WndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     30static MRESULT EXPENTRY SYSTRAY_Old_WndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    5931{
    6032    SystrayItem *ptrayItem = (SystrayItem *)WinQueryWindowULong(hWnd, QWL_USER);
     
    11183}
    11284
    113 //extern HAB hab;
    114 const char * const systraysupclass = "Odin32SystraySupport";
     85static const char * const systraysupclass = "Odin32SystraySupport";
    11586
    116 BOOL SYSTRAY_RegisterClass(void)
     87static BOOL SYSTRAY_Old_RegisterClass(void)
    11788{
    118     //WinRegisterClass( hab, systraysupclass, SYSTRAY_WndProc, 0, sizeof(ULONG) );
    119     WinRegisterClass(0, systraysupclass, SYSTRAY_WndProc, 0, sizeof(ULONG) );
     89    //WinRegisterClass( hab, systraysupclass, SYSTRAY_Old_WndProc, 0, sizeof(ULONG) );
     90    WinRegisterClass(0, systraysupclass, SYSTRAY_Old_WndProc, 0, sizeof(ULONG) );
    12091    return TRUE;
    12192}
    12293
    12394
    124 BOOL SYSTRAY_ItemInit(SystrayItem *ptrayItem)
     95static BOOL SYSTRAY_Old_ItemInit(SystrayItem *ptrayItem)
    12596{
    12697    ULONG fcf = FCF_TITLEBAR;
    12798
    128     if ( !SYSTRAY_RegisterClass() )
     99    if ( !SYSTRAY_Old_RegisterClass() )
    129100    {
    130101        return FALSE;
     
    152123}
    153124
    154 void SYSTRAY_ItemTerm(SystrayItem *ptrayItem)
     125static void SYSTRAY_Old_ItemTerm(SystrayItem *ptrayItem)
    155126{
    156127    HPOINTER hIcon = (HPOINTER)WinSendMsg(ptrayItem->hWndFrame, WM_QUERYICON, NULL, NULL);
     
    162133
    163134
    164 void SYSTRAY_ItemSetMessage(SystrayItem *ptrayItem, ULONG uCallbackMessage)
     135static void SYSTRAY_Old_ItemSetMessage(SystrayItem *ptrayItem, ULONG uCallbackMessage)
    165136{
    166137  ptrayItem->notifyIcon.uCallbackMessage = uCallbackMessage;
     
    168139
    169140
    170 void SYSTRAY_ItemSetIcon(SystrayItem *ptrayItem, HPOINTER hIcon)
     141static void SYSTRAY_Old_ItemSetIcon(SystrayItem *ptrayItem, HPOINTER hIcon)
    171142{
    172143    // Windows seems to make a copy of icons displayed in the tray area. At
     
    174145    // Shell_NotifyIcon() doesn't harm the icon displayed in the tray. Behave
    175146    // similarly on OS/2 (some applications do call DestroyIcon()). The copy is
    176     // deleted in SYSTRAY_ItemTerm().
     147    // deleted in SYSTRAY_Old_ItemTerm().
    177148
    178149    POINTERINFO Info;
     
    193164
    194165
    195 void SYSTRAY_ItemSetTip(SystrayItem *ptrayItem, CHAR* szTip, int modify)
     166static void SYSTRAY_Old_ItemSetTip(SystrayItem *ptrayItem, CHAR* szTip, int modify)
    196167{
    197168        char tmp[ 64 ];
     
    204175}
    205176
     177
     178BOOL SYSTRAY_Init(void)
     179{
     180    // try the new xsystray API first
     181    if (SYSTRAY_Ex_Init())
     182        return TRUE;
     183
     184    // fallback to the old API
     185    SYSTRAY_ItemInit = SYSTRAY_Old_ItemInit;
     186    SYSTRAY_ItemTerm = SYSTRAY_Old_ItemTerm;
     187    SYSTRAY_ItemSetMessage = SYSTRAY_Old_ItemSetMessage;
     188    SYSTRAY_ItemSetIcon = SYSTRAY_Old_ItemSetIcon;
     189    SYSTRAY_ItemSetTip = SYSTRAY_Old_ItemSetTip;
     190
     191    return TRUE;
     192}
     193
Note: See TracChangeset for help on using the changeset viewer.