Alexandre Julliard : explorer: Use a different return value to indicate that the x11 system tray is not available , so that x11drv can return errors too.

Alexandre Julliard julliard at winehq.org
Tue May 13 14:10:37 CDT 2008


Module: wine
Branch: master
Commit: 26e566b91f0ba2d8ab9dd5537ad40480d72556e5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=26e566b91f0ba2d8ab9dd5537ad40480d72556e5

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue May 13 20:56:25 2008 +0200

explorer: Use a different return value to indicate that the x11 system tray is not available, so that x11drv can return errors too.

---

 dlls/winex11.drv/systray.c  |    6 ++++--
 programs/explorer/systray.c |    9 +++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c
index d2a07fc..dffacf5 100644
--- a/dlls/winex11.drv/systray.c
+++ b/dlls/winex11.drv/systray.c
@@ -415,7 +415,7 @@ static BOOL delete_icon( struct tray_icon *icon )
  *
  * Driver-side implementation of Shell_NotifyIcon.
  */
-BOOL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data )
+int wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data )
 {
     BOOL ret = FALSE;
     struct tray_icon *icon;
@@ -423,7 +423,9 @@ BOOL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data )
     switch (msg)
     {
     case NIM_ADD:
-        if (get_systray_selection_owner( thread_display() )) ret = add_icon( data );
+        if (!get_systray_selection_owner( thread_display() ))
+            return -1;  /* fall back to default handling */
+        ret = add_icon( data );
         break;
     case NIM_DELETE:
         if ((icon = get_icon( data->hWnd, data->uID ))) ret = delete_icon( icon );
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c
index b259b81..8b82d9a 100644
--- a/programs/explorer/systray.c
+++ b/programs/explorer/systray.c
@@ -35,7 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(systray);
 #define IS_OPTION_FALSE(ch) \
     ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
 
-static BOOL (*wine_notify_icon)(DWORD,NOTIFYICONDATAW *);
+static int (*wine_notify_icon)(DWORD,NOTIFYICONDATAW *);
 
 /* an individual systray icon, unpacked from the NOTIFYICONDATA and always in unicode */
 struct icon
@@ -348,7 +348,7 @@ static BOOL handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
     struct icon *icon = NULL;
     NOTIFYICONDATAW nid;
     DWORD cbSize;
-    BOOL ret = FALSE;
+    int ret = FALSE;
 
     if (cds->cbData < NOTIFYICONDATAW_V1_SIZE) return FALSE;
     cbSize = ((PNOTIFYICONDATA)cds->lpData)->cbSize;
@@ -398,11 +398,12 @@ static BOOL handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
     /* try forward to x11drv first */
     if (cds->dwData == NIM_ADD || !(icon = get_icon( nid.hWnd, nid.uID )))
     {
-        if (wine_notify_icon && wine_notify_icon( cds->dwData, &nid ))
+        if (wine_notify_icon && ((ret = wine_notify_icon( cds->dwData, &nid )) != -1))
         {
             if (nid.uFlags & NIF_ICON) DestroyIcon( nid.hIcon );
-            return TRUE;
+            return ret;
         }
+        ret = FALSE;
     }
 
     switch (cds->dwData)




More information about the wine-cvs mailing list