From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/systray.c | 70 +++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index dde2feb6b0e..42b1e3bc9ed 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -33,7 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(systray); BOOL show_systray = TRUE;
/* an individual systray icon */ -struct tray_icon +struct icon { struct list entry; HICON image; /* the image to render */ @@ -59,9 +59,9 @@ static struct list icon_list = LIST_INIT( icon_list ); static const WCHAR icon_classname[] = {'_','_','w','i','n','e','x','1','1','_','t','r','a','y','_','i','c','o','n',0}; static const WCHAR tray_classname[] = {'_','_','w','i','n','e','x','1','1','_','s','t','a','n','d','a','l','o','n','e','_','t','r','a','y',0};
-static BOOL show_icon( struct tray_icon *icon ); -static BOOL hide_icon( struct tray_icon *icon ); -static BOOL delete_icon( struct tray_icon *icon ); +static BOOL show_icon( struct icon *icon ); +static BOOL hide_icon( struct icon *icon ); +static BOOL delete_icon( struct icon *icon );
#define MIN_DISPLAYED 8 #define ICON_BORDER 2 @@ -73,7 +73,7 @@ static BOOL delete_icon( struct tray_icon *icon ); #define BALLOON_SHOW_MIN_TIMEOUT 10000 #define BALLOON_SHOW_MAX_TIMEOUT 30000
-static struct tray_icon *balloon_icon; +static struct icon *balloon_icon; static HWND balloon_window; static POINT balloon_pos;
@@ -83,11 +83,11 @@ static int icon_cx, icon_cy; static unsigned int nb_displayed;
/* retrieves icon record by owner window and ID */ -static struct tray_icon *get_icon(HWND owner, UINT id) +static struct icon *get_icon(HWND owner, UINT id) { - struct tray_icon *this; + struct icon *this;
- LIST_FOR_EACH_ENTRY( this, &icon_list, struct tray_icon, entry ) + LIST_FOR_EACH_ENTRY( this, &icon_list, struct icon, entry ) if ((this->id == id) && (this->owner == owner)) return this; return NULL; } @@ -109,7 +109,7 @@ static void init_common_controls(void) }
/* create tooltip window for icon */ -static void create_tooltip(struct tray_icon *icon) +static void create_tooltip(struct icon *icon) { init_common_controls(); icon->tooltip = CreateWindowExW( WS_EX_TOPMOST, TOOLTIPS_CLASSW, NULL, @@ -144,7 +144,7 @@ static void update_systray_balloon_position(void) SendMessageW( balloon_window, TTM_TRACKPOSITION, 0, MAKELONG( pos.x, pos.y )); }
-static void balloon_create_timer( struct tray_icon *icon ) +static void balloon_create_timer( struct icon *icon ) { TTTOOLINFOW ti;
@@ -173,7 +173,7 @@ static void balloon_create_timer( struct tray_icon *icon ) SetTimer( icon->window, BALLOON_SHOW_TIMER, icon->info_timeout, NULL ); }
-static BOOL show_balloon( struct tray_icon *icon ) +static BOOL show_balloon( struct icon *icon ) { if (standalone_tray && !show_systray) return FALSE; /* no systray window */ if (!icon->window) return FALSE; /* not displayed */ @@ -198,13 +198,13 @@ static void hide_balloon(void)
static void show_next_balloon(void) { - struct tray_icon *icon; + struct icon *icon;
- LIST_FOR_EACH_ENTRY( icon, &icon_list, struct tray_icon, entry ) + LIST_FOR_EACH_ENTRY( icon, &icon_list, struct icon, entry ) if (show_balloon( icon )) break; }
-static void update_balloon( struct tray_icon *icon ) +static void update_balloon( struct icon *icon ) { if (balloon_icon == icon) { @@ -226,7 +226,7 @@ static void balloon_timer(void) }
/* synchronize tooltip text with tooltip window */ -static void update_tooltip_text(struct tray_icon *icon) +static void update_tooltip_text(struct icon *icon) { TTTOOLINFOW ti;
@@ -257,7 +257,7 @@ static SIZE get_window_size(void) }
/* get the position of an icon in the stand-alone tray */ -static POINT get_icon_pos( struct tray_icon *icon ) +static POINT get_icon_pos( struct icon *icon ) { POINT pos;
@@ -287,7 +287,7 @@ static LRESULT WINAPI standalone_tray_wndproc( HWND hwnd, UINT msg, WPARAM wpara }
/* add an icon to the standalone tray window */ -static void add_to_standalone_tray( struct tray_icon *icon ) +static void add_to_standalone_tray( struct icon *icon ) { SIZE size; POINT pos; @@ -320,14 +320,14 @@ static void add_to_standalone_tray( struct tray_icon *icon ) }
/* remove an icon from the stand-alone tray */ -static void remove_from_standalone_tray( struct tray_icon *icon ) +static void remove_from_standalone_tray( struct icon *icon ) { - struct tray_icon *ptr; + struct icon *ptr; POINT pos;
if (icon->display == -1) return;
- LIST_FOR_EACH_ENTRY( ptr, &icon_list, struct tray_icon, entry ) + LIST_FOR_EACH_ENTRY( ptr, &icon_list, struct icon, entry ) { if (ptr == icon) continue; if (ptr->display < icon->display) continue; @@ -340,7 +340,7 @@ static void remove_from_standalone_tray( struct tray_icon *icon ) TRACE( "removed %u now %d icons\n", icon->id, nb_displayed ); }
-static void repaint_tray_icon( struct tray_icon *icon ) +static void repaint_tray_icon( struct icon *icon ) { BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; int width = GetSystemMetrics( SM_CXSMICON ); @@ -415,7 +415,7 @@ done: if (dib) DeleteObject( dib ); }
-static BOOL notify_owner( struct tray_icon *icon, UINT msg, LPARAM lparam ) +static BOOL notify_owner( struct icon *icon, UINT msg, LPARAM lparam ) { WPARAM wp = icon->id; LPARAM lp = msg; @@ -443,7 +443,7 @@ static BOOL notify_owner( struct tray_icon *icon, UINT msg, LPARAM lparam ) /* window procedure for the individual tray icon window */ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - struct tray_icon *icon = NULL; + struct icon *icon = NULL;
TRACE("hwnd=%p, msg=0x%x\n", hwnd, msg);
@@ -451,7 +451,7 @@ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR if (msg == WM_NCCREATE) SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LPARAM)((const CREATESTRUCTW *)lparam)->lpCreateParams);
- icon = (struct tray_icon *) GetWindowLongPtrW(hwnd, GWLP_USERDATA); + icon = (struct icon *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
switch (msg) { @@ -581,9 +581,9 @@ NTSTATUS WINAPI x11drv_systray_change_owner( void *arg, ULONG size ) { struct systray_change_owner_params *params = arg; struct systray_dock_params dock_params; - struct tray_icon *icon; + struct icon *icon;
- LIST_FOR_EACH_ENTRY( icon, &icon_list, struct tray_icon, entry ) + LIST_FOR_EACH_ENTRY( icon, &icon_list, struct icon, entry ) { if (icon->display == -1) continue; hide_icon( icon ); @@ -600,7 +600,7 @@ NTSTATUS WINAPI x11drv_systray_change_owner( void *arg, ULONG size ) }
/* hide a tray icon */ -static BOOL hide_icon( struct tray_icon *icon ) +static BOOL hide_icon( struct icon *icon ) { TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner );
@@ -618,7 +618,7 @@ static BOOL hide_icon( struct tray_icon *icon ) }
/* make the icon visible */ -static BOOL show_icon( struct tray_icon *icon ) +static BOOL show_icon( struct icon *icon ) { struct systray_dock_params params;
@@ -640,7 +640,7 @@ static BOOL show_icon( struct tray_icon *icon ) }
/* Modifies an existing icon record */ -static BOOL modify_icon( struct tray_icon *icon, NOTIFYICONDATAW *nid ) +static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid ) { TRACE( "id=0x%x hwnd=%p flags=%x\n", nid->uID, nid->hWnd, nid->uFlags );
@@ -687,7 +687,7 @@ static BOOL modify_icon( struct tray_icon *icon, NOTIFYICONDATAW *nid ) /* Adds a new icon record to the list */ static BOOL add_icon(NOTIFYICONDATAW *nid) { - struct tray_icon *icon; + struct icon *icon;
TRACE("id=0x%x, hwnd=%p\n", nid->uID, nid->hWnd);
@@ -703,7 +703,7 @@ static BOOL add_icon(NOTIFYICONDATAW *nid) return FALSE; }
- ZeroMemory(icon, sizeof(struct tray_icon)); + ZeroMemory(icon, sizeof(struct icon)); icon->id = nid->uID; icon->owner = nid->hWnd; icon->display = -1; @@ -714,7 +714,7 @@ static BOOL add_icon(NOTIFYICONDATAW *nid) }
/* delete tray icon window and icon structure */ -static BOOL delete_icon( struct tray_icon *icon ) +static BOOL delete_icon( struct icon *icon ) { hide_icon( icon ); list_remove( &icon->entry ); @@ -726,9 +726,9 @@ static BOOL delete_icon( struct tray_icon *icon ) /* cleanup all icons for a given window */ static void cleanup_icons( HWND owner ) { - struct tray_icon *this, *next; + struct icon *this, *next;
- LIST_FOR_EACH_ENTRY_SAFE( this, next, &icon_list, struct tray_icon, entry ) + LIST_FOR_EACH_ENTRY_SAFE( this, next, &icon_list, struct icon, entry ) if (this->owner == owner) delete_icon( this ); }
@@ -741,7 +741,7 @@ static void cleanup_icons( HWND owner ) int CDECL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data ) { BOOL ret = FALSE; - struct tray_icon *icon; + struct icon *icon;
switch (msg) {
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/systray.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index 42b1e3bc9ed..3ef654aa424 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -56,8 +56,8 @@ struct icon
static struct list icon_list = LIST_INIT( icon_list );
-static const WCHAR icon_classname[] = {'_','_','w','i','n','e','x','1','1','_','t','r','a','y','_','i','c','o','n',0}; -static const WCHAR tray_classname[] = {'_','_','w','i','n','e','x','1','1','_','s','t','a','n','d','a','l','o','n','e','_','t','r','a','y',0}; +static const WCHAR icon_classname[] = L"__winex11_tray_icon"; +static const WCHAR tray_classname[] = L"__winex11_standalone_tray";
static BOOL show_icon( struct icon *icon ); static BOOL hide_icon( struct icon *icon ); @@ -294,10 +294,8 @@ static void add_to_standalone_tray( struct icon *icon )
if (!standalone_tray) { - static const WCHAR winname[] = {'W','i','n','e',' ','S','y','s','t','e','m',' ','T','r','a','y',0}; - size = get_window_size(); - standalone_tray = CreateWindowExW( 0, tray_classname, winname, WS_CAPTION | WS_SYSMENU, + standalone_tray = CreateWindowExW( 0, tray_classname, L"Wine System Tray", WS_CAPTION | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, size.cx, size.cy, 0, 0, 0, 0 ); if (!standalone_tray) return; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/systray.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index 3ef654aa424..9ba6abdd6f5 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -360,7 +360,7 @@ static void repaint_tray_icon( struct icon *icon ) pos.x = (size.cx - width) / 2; pos.y = (size.cy - height) / 2;
- info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[2] )); + info = calloc( 1, FIELD_OFFSET( BITMAPINFO, bmiColors[2] )); if (!info) return; info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = size.cx; @@ -408,7 +408,7 @@ static void repaint_tray_icon( struct icon *icon )
UpdateLayeredWindow( icon->window, 0, NULL, NULL, hdc, NULL, 0, &blend, ULW_ALPHA ); done: - HeapFree (GetProcessHeap(), 0, info); + free(info); if (hdc) DeleteDC( hdc ); if (dib) DeleteObject( dib ); } @@ -695,7 +695,7 @@ static BOOL add_icon(NOTIFYICONDATAW *nid) return FALSE; }
- if (!(icon = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*icon)))) + if (!(icon = calloc(1, sizeof(*icon)))) { ERR("out of memory\n"); return FALSE; @@ -717,7 +717,7 @@ static BOOL delete_icon( struct icon *icon ) hide_icon( icon ); list_remove( &icon->entry ); DestroyIcon( icon->image ); - HeapFree( GetProcessHeap(), 0, icon ); + free( icon ); return TRUE; }
This merge request was closed by Rémi Bernon.
I guess this isn't strictly necessary as I intend to move everything here into explorer, though it was intended to make comparing the code easier.