[PATCH v2 1/2] explorer: Improve tray sizing and style.

Zebediah Figura zfigura at codeweavers.com
Mon Jul 10 11:46:33 CDT 2017


v2: use appropriate system metrics.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 programs/explorer/systray.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c
index 9e58ad48333..62036bf38b2 100644
--- a/programs/explorer/systray.c
+++ b/programs/explorer/systray.c
@@ -108,7 +108,7 @@ static struct icon *balloon_icon;
 static HWND balloon_window;
 
 #define MIN_DISPLAYED 8
-#define ICON_BORDER  2
+#define ICON_BORDER  3
 
 #define BALLOON_CREATE_TIMER 1
 #define BALLOON_SHOW_TIMER   2
@@ -653,12 +653,10 @@ static void paint_taskbar_button( const DRAWITEMSTRUCT *dis )
     if (!win) return;
     GetClientRect( dis->hwndItem, &rect );
     DrawFrameControl( dis->hDC, &rect, DFC_BUTTON, DFCS_BUTTONPUSH | DFCS_ADJUSTRECT |
-                      ((dis->itemState & ODS_SELECTED) ? DFCS_PUSHED : 0 ));
+                      ((dis->itemState & ODS_SELECTED) ? DFCS_PUSHED : 0) |
+                      (win->hwnd && win->active ? DFCS_CHECKED : 0) );
     if (win->hwnd)
-    {
-        flags |= win->active ? DC_ACTIVE : DC_INBUTTON;
-        DrawCaptionTempW( win->hwnd, dis->hDC, &rect, 0, 0, NULL, flags );
-    }
+        DrawCaptionTempW( win->hwnd, dis->hDC, &rect, 0, 0, NULL, flags | DC_INBUTTON | DC_ICON );
     else  /* start button */
         DrawCaptionTempW( 0, dis->hDC, &rect, 0, 0, start_label, flags | DC_INBUTTON | DC_ICON );
 }
@@ -748,6 +746,7 @@ static void do_show_systray(void)
     NONCLIENTMETRICSW ncm;
     HFONT font;
     HDC hdc = GetDC( 0 );
+    int border_width, border_height;
 
     ncm.cbSize = sizeof(NONCLIENTMETRICSW);
     SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0 );
@@ -765,9 +764,11 @@ static void do_show_systray(void)
 
     tray_width = GetSystemMetrics( SM_CXSCREEN );
     tray_height = max( icon_cy, size.cy );
+    border_width = GetSystemMetrics( SM_CXFRAME );
+    border_height = GetSystemMetrics( SM_CYFRAME );
     start_button_width = size.cx;
-    SetWindowPos( tray_window, HWND_TOPMOST, 0, GetSystemMetrics( SM_CYSCREEN ) - tray_height,
-                  tray_width, tray_height, SWP_NOACTIVATE | SWP_SHOWWINDOW );
+    SetWindowPos( tray_window, HWND_TOPMOST, -(border_width / 2), GetSystemMetrics(SM_CYSCREEN) - tray_height - (3 * border_height / 2),
+                  tray_width + border_width, tray_height + (border_height * 2), SWP_NOACTIVATE | SWP_SHOWWINDOW );
     sync_taskbar_buttons();
 }
 
@@ -925,7 +926,8 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab
         return;
     }
 
-    tray_window = CreateWindowExW( WS_EX_NOACTIVATE, classname, NULL, WS_POPUP,
+    tray_window = CreateWindowExW( WS_EX_TOOLWINDOW|WS_EX_TOPMOST, classname, NULL,
+                                   WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER | WS_THICKFRAME,
                                    0, GetSystemMetrics( SM_CYSCREEN ), 0, 0, 0, 0, 0, 0 );
     if (!tray_window)
     {
-- 
2.13.2




More information about the wine-patches mailing list