@@ -1309,10 +1309,14 @@ fn position_at_taskbar() {
13091309
13101310 let taskbar_height = taskbar_rect. bottom - taskbar_rect. top ;
13111311 let mut tray_left = taskbar_rect. right ;
1312+ let mut anchor_top = taskbar_rect. top ;
1313+ let mut anchor_height = taskbar_height;
13121314
13131315 if let Some ( tray_hwnd) = native_interop:: find_child_window ( taskbar_hwnd, "TrayNotifyWnd" ) {
13141316 if let Some ( tray_rect) = native_interop:: get_window_rect_safe ( tray_hwnd) {
13151317 tray_left = tray_rect. left ;
1318+ anchor_top = tray_rect. top ;
1319+ anchor_height = tray_rect. bottom - tray_rect. top ;
13161320 }
13171321 }
13181322
@@ -1322,15 +1326,15 @@ fn position_at_taskbar() {
13221326 if embedded {
13231327 // Child window: coordinates relative to parent (taskbar)
13241328 let x = tray_left - taskbar_rect. left - widget_width - tray_offset;
1325- let y = ( taskbar_height - widget_height) / 2 ;
1329+ let y = ( anchor_top - taskbar_rect . top ) + ( anchor_height - widget_height) / 2 ;
13261330 native_interop:: move_window ( hwnd, x, y, widget_width, widget_height) ;
13271331 diagnose:: log ( format ! (
13281332 "positioned embedded widget at x={x} y={y} w={widget_width} h={widget_height}"
13291333 ) ) ;
13301334 } else {
13311335 // Topmost popup: screen coordinates
13321336 let x = tray_left - widget_width - tray_offset;
1333- let y = taskbar_rect . top + ( taskbar_height - widget_height) / 2 ;
1337+ let y = anchor_top + ( anchor_height - widget_height) / 2 ;
13341338 native_interop:: move_window ( hwnd, x, y, widget_width, widget_height) ;
13351339 diagnose:: log ( format ! (
13361340 "positioned fallback widget at x={x} y={y} w={widget_width} h={widget_height}"
@@ -1556,19 +1560,24 @@ unsafe extern "system" fn wnd_proc(
15561560 if let Some ( taskbar_rect) = native_interop:: get_taskbar_rect ( taskbar_hwnd) {
15571561 let taskbar_height = taskbar_rect. bottom - taskbar_rect. top ;
15581562 let mut tray_left = taskbar_rect. right ;
1563+ let mut anchor_top = taskbar_rect. top ;
1564+ let mut anchor_height = taskbar_height;
15591565 if let Some ( tray_hwnd) =
15601566 native_interop:: find_child_window ( taskbar_hwnd, "TrayNotifyWnd" )
15611567 {
15621568 if let Some ( tray_rect) = native_interop:: get_window_rect_safe ( tray_hwnd)
15631569 {
15641570 tray_left = tray_rect. left ;
1571+ anchor_top = tray_rect. top ;
1572+ anchor_height = tray_rect. bottom - tray_rect. top ;
15651573 }
15661574 }
15671575 let widget_width = total_widget_width ( ) ;
15681576 let widget_height = sc ( WIDGET_HEIGHT ) ;
15691577 if s. embedded {
15701578 let x = tray_left - taskbar_rect. left - widget_width - new_offset;
1571- let y = ( taskbar_height - widget_height) / 2 ;
1579+ let y =
1580+ ( anchor_top - taskbar_rect. top ) + ( anchor_height - widget_height) / 2 ;
15721581 native_interop:: move_window (
15731582 hwnd_val,
15741583 x,
@@ -1578,7 +1587,7 @@ unsafe extern "system" fn wnd_proc(
15781587 ) ;
15791588 } else {
15801589 let x = tray_left - widget_width - new_offset;
1581- let y = taskbar_rect . top + ( taskbar_height - widget_height) / 2 ;
1590+ let y = anchor_top + ( anchor_height - widget_height) / 2 ;
15821591 native_interop:: move_window (
15831592 hwnd_val,
15841593 x,
0 commit comments