Alexandre Julliard : winex11: Get rid of the useless systray hidden flag.

Alexandre Julliard julliard at winehq.org
Wed Apr 9 14:31:22 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Apr  9 16:22:57 2008 +0200

winex11: Get rid of the useless systray hidden flag.

---

 dlls/winex11.drv/systray.c |   33 +++++++++++----------------------
 1 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c
index 25d0e60..460fd47 100644
--- a/dlls/winex11.drv/systray.c
+++ b/dlls/winex11.drv/systray.c
@@ -55,7 +55,6 @@ struct tray_icon
     HWND           tooltip;  /* Icon tooltip */
     UINT           id;       /* the unique id given by the app */
     UINT           callback_message;
-    BOOL           hidden;   /* icon display state */
     WCHAR          tiptext[128]; /* Tooltip text. If empty => tooltip disabled */
 };
 
@@ -259,14 +258,12 @@ static BOOL hide_icon( struct tray_icon *icon )
 {
     TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner );
 
-    if (!icon->window || icon->hidden) return TRUE;  /* already hidden */
+    if (!icon->window) return TRUE;  /* already hidden */
 
-    if (icon->window)
-    {
-        DestroyWindow(icon->window);
-        DestroyWindow(icon->tooltip);
-    }
-    icon->hidden = TRUE;
+    DestroyWindow(icon->window);
+    DestroyWindow(icon->tooltip);
+    icon->window = 0;
+    icon->tooltip = 0;
     return TRUE;
 }
 
@@ -279,7 +276,7 @@ static BOOL show_icon( struct tray_icon *icon )
 
     TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner );
 
-    if (icon->window && !icon->hidden) return TRUE;  /* already shown */
+    if (icon->window) return TRUE;  /* already shown */
 
     if (!class_registered)
     {
@@ -315,7 +312,6 @@ static BOOL show_icon( struct tray_icon *icon )
     dock_systray_window( icon->window, systray_window );
     SetTimer( icon->window, 1, 1000, NULL );
     ShowWindow( icon->window, SW_SHOWNA );
-    icon->hidden = FALSE;
     return TRUE;
 }
 
@@ -330,15 +326,11 @@ static BOOL modify_icon( struct tray_icon *icon, NOTIFYICONDATAW *nid )
         else show_icon( icon );
     }
 
-    /* startup case*/
-    if (!icon->window && !icon->hidden) show_icon( icon );
-
     if (nid->uFlags & NIF_ICON)
     {
         if (icon->image) DestroyIcon(icon->image);
         icon->image = CopyIcon(nid->hIcon);
-
-        if (!icon->hidden)
+        if (icon->window)
         {
             struct x11drv_win_data *data = X11DRV_get_win_data( icon->window );
             if (data) XClearArea( gdi_display, data->client_window, 0, 0, 0, 0, True );
@@ -352,8 +344,7 @@ static BOOL modify_icon( struct tray_icon *icon, NOTIFYICONDATAW *nid )
     if (nid->uFlags & NIF_TIP)
     {
         lstrcpynW(icon->tiptext, nid->szTip, sizeof(icon->tiptext)/sizeof(WCHAR));
-        if (!icon->hidden)
-            update_tooltip_text(icon);
+        if (icon->tooltip) update_tooltip_text(icon);
     }
     if (nid->uFlags & NIF_INFO && nid->cbSize >= NOTIFYICONDATAA_V2_SIZE)
     {
@@ -387,11 +378,9 @@ static BOOL add_icon(NOTIFYICONDATAW *nid)
 
     list_add_tail(&icon_list, &icon->entry);
 
-    /*
-     * Both icon->window and icon->hidden are zero. modify_icon function
-     * will treat this case as a startup, i.e. icon window will be created if
-     * NIS_HIDDEN flag is not set.
-     */
+    /* if hidden state is specified, modify_icon will take care of it */
+    if (!((nid->uFlags & NIF_STATE) && (nid->dwStateMask & NIS_HIDDEN)))
+        show_icon( icon );
 
     return modify_icon( icon, nid );
 }




More information about the wine-cvs mailing list