Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ec9024ca
Commit
ec9024ca
authored
Sep 14, 2005
by
Thomas Weidenmueller
Committed by
Alexandre Julliard
Sep 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hook up "Hide on Minimize" & Add context menu to the tray icon.
parent
63308e5a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
10 deletions
+82
-10
En.rc
programs/taskmgr/En.rc
+7
-4
optnmenu.c
programs/taskmgr/optnmenu.c
+1
-3
taskmgr.c
programs/taskmgr/taskmgr.c
+65
-0
taskmgr.h
programs/taskmgr/taskmgr.h
+6
-0
trayicon.c
programs/taskmgr/trayicon.c
+3
-3
No files found.
programs/taskmgr/En.rc
View file @
ec9024ca
...
...
@@ -129,10 +129,13 @@ END
IDR_TRAY_POPUP MENU DISCARDABLE
BEGIN
MENUITEM "&Restore", ID_RESTORE
MENUITEM "&Close", ID_FILE_EXIT
MENUITEM SEPARATOR
MENUITEM "&Always On Top", ID_OPTIONS_ALWAYSONTOP, CHECKED
POPUP "DUMMY"
BEGIN
MENUITEM "&Restore", ID_RESTORE
MENUITEM "&Close", ID_FILE_EXIT
MENUITEM SEPARATOR
MENUITEM "&Always On Top", ID_OPTIONS_ALWAYSONTOP
END
END
IDR_PROCESS_PAGE_CONTEXT MENU DISCARDABLE
...
...
programs/taskmgr/optnmenu.c
View file @
ec9024ca
...
...
@@ -37,8 +37,6 @@
#include "taskmgr.h"
#define OPTIONS_MENU_INDEX 1
void
TaskManager_OnOptionsAlwaysOnTop
(
void
)
{
HMENU
hMenu
;
...
...
@@ -51,7 +49,7 @@ void TaskManager_OnOptionsAlwaysOnTop(void)
* Check or uncheck the always on top menu item
* and update main window.
*/
if
(
GetMenuState
(
hOptionsMenu
,
ID_OPTIONS_ALWAYSONTOP
,
MF_BYCOMMAND
)
&
MF_CHECKED
)
if
(
(
GetWindowLong
(
hMainWnd
,
GWL_EXSTYLE
)
&
WS_EX_TOPMOST
)
!=
0
)
{
CheckMenuItem
(
hOptionsMenu
,
ID_OPTIONS_ALWAYSONTOP
,
MF_BYCOMMAND
|
MF_UNCHECKED
);
TaskManagerSettings
.
AlwaysOnTop
=
FALSE
;
...
...
programs/taskmgr/taskmgr.c
View file @
ec9024ca
...
...
@@ -144,6 +144,9 @@ TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case
ID_OPTIONS_SHOW16BITTASKS
:
TaskManager_OnOptionsShow16BitTasks
();
break
;
case
ID_RESTORE
:
TaskManager_OnRestoreMainWindow
();
break
;
case
ID_VIEW_LARGE
:
ApplicationPage_OnViewLargeIcons
();
break
;
...
...
@@ -249,6 +252,48 @@ TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
}
break
;
case
WM_ONTRAYICON
:
switch
(
lParam
)
{
case
WM_RBUTTONDOWN
:
{
POINT
pt
;
BOOL
OnTop
;
HMENU
hMenu
,
hPopupMenu
;
GetCursorPos
(
&
pt
);
OnTop
=
((
GetWindowLong
(
hMainWnd
,
GWL_EXSTYLE
)
&
WS_EX_TOPMOST
)
!=
0
);
hMenu
=
LoadMenu
(
hInst
,
MAKEINTRESOURCE
(
IDR_TRAY_POPUP
));
hPopupMenu
=
GetSubMenu
(
hMenu
,
0
);
if
(
IsWindowVisible
(
hMainWnd
))
{
DeleteMenu
(
hPopupMenu
,
ID_RESTORE
,
MF_BYCOMMAND
);
}
else
{
SetMenuDefaultItem
(
hPopupMenu
,
ID_RESTORE
,
FALSE
);
}
if
(
OnTop
)
{
CheckMenuItem
(
hPopupMenu
,
ID_OPTIONS_ALWAYSONTOP
,
MF_BYCOMMAND
|
MF_CHECKED
);
}
SetForegroundWindow
(
hMainWnd
);
TrackPopupMenuEx
(
hPopupMenu
,
0
,
pt
.
x
,
pt
.
y
,
hMainWnd
,
NULL
);
DestroyMenu
(
hMenu
);
break
;
}
case
WM_LBUTTONDBLCLK
:
TaskManager_OnRestoreMainWindow
();
break
;
}
break
;
case
WM_NOTIFY
:
idctrl
=
(
int
)
wParam
;
pnmh
=
(
LPNMHDR
)
lParam
;
...
...
@@ -613,7 +658,13 @@ void OnSize( UINT nType, int cx, int cy )
RECT
rc
;
if
(
nType
==
SIZE_MINIMIZED
)
{
if
(
TaskManagerSettings
.
HideWhenMinimized
)
{
ShowWindow
(
hMainWnd
,
SW_HIDE
);
}
return
;
}
nXDifference
=
cx
-
nOldWidth
;
nYDifference
=
cy
-
nOldHeight
;
...
...
@@ -778,6 +829,20 @@ void SaveSettings(void)
RegCloseKey
(
hKey
);
}
void
TaskManager_OnRestoreMainWindow
(
void
)
{
HMENU
hMenu
,
hOptionsMenu
;
BOOL
OnTop
;
hMenu
=
GetMenu
(
hMainWnd
);
hOptionsMenu
=
GetSubMenu
(
hMenu
,
OPTIONS_MENU_INDEX
);
OnTop
=
((
GetWindowLong
(
hMainWnd
,
GWL_EXSTYLE
)
&
WS_EX_TOPMOST
)
!=
0
);
OpenIcon
(
hMainWnd
);
SetForegroundWindow
(
hMainWnd
);
SetWindowPos
(
hMainWnd
,
(
OnTop
?
HWND_TOPMOST
:
HWND_TOP
),
0
,
0
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOMOVE
|
SWP_SHOWWINDOW
);
}
void
TaskManager_OnEnterMenuLoop
(
HWND
hWnd
)
{
int
nParts
;
...
...
programs/taskmgr/taskmgr.h
View file @
ec9024ca
...
...
@@ -153,6 +153,7 @@ void Draw3dRect2(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottom
void
Font_DrawText
(
HDC
hDC
,
LPCTSTR
lpszText
,
int
x
,
int
y
);
void
LoadSettings
(
void
);
void
SaveSettings
(
void
);
void
TaskManager_OnRestoreMainWindow
(
void
);
void
TaskManager_OnEnterMenuLoop
(
HWND
hWnd
);
void
TaskManager_OnExitMenuLoop
(
HWND
hWnd
);
void
TaskManager_OnMenuSelect
(
HWND
hWnd
,
UINT
nItemID
,
UINT
nFlags
,
HMENU
hSysMenu
);
...
...
@@ -162,6 +163,9 @@ void TaskManager_OnViewUpdateSpeedLow(void);
void
TaskManager_OnViewUpdateSpeedPaused
(
void
);
void
TaskManager_OnViewRefresh
(
void
);
void
TaskManager_OnTabWndSelChange
(
void
);
#define OPTIONS_MENU_INDEX 1
void
TaskManager_OnOptionsAlwaysOnTop
(
void
);
void
TaskManager_OnOptionsMinimizeOnUse
(
void
);
void
TaskManager_OnOptionsHideWhenMinimized
(
void
);
...
...
@@ -186,6 +190,8 @@ void ProcessPage_OnSetPriorityBelowNormal(void);
void
ProcessPage_OnSetPriorityLow
(
void
);
void
ProcessPage_OnDebugChannels
(
void
);
#define WM_ONTRAYICON WM_USER + 5
HICON
TrayIcon_GetProcessorUsageIcon
(
void
);
BOOL
TrayIcon_ShellAddTrayIcon
(
void
);
BOOL
TrayIcon_ShellRemoveTrayIcon
(
void
);
...
...
programs/taskmgr/trayicon.c
View file @
ec9024ca
...
...
@@ -155,7 +155,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
nid
.
hWnd
=
hMainWnd
;
nid
.
uID
=
0
;
nid
.
uFlags
=
NIF_ICON
|
NIF_MESSAGE
|
NIF_TIP
;
/* nid.uCallbackMessage = ??; */
nid
.
uCallbackMessage
=
WM_ONTRAYICON
;
nid
.
hIcon
=
hIcon
;
wsprintf
(
nid
.
szTip
,
_T
(
"CPU Usage: %d%%"
),
PerfDataGetProcessorUsage
());
...
...
@@ -178,7 +178,7 @@ BOOL TrayIcon_ShellRemoveTrayIcon(void)
nid
.
hWnd
=
hMainWnd
;
nid
.
uID
=
0
;
nid
.
uFlags
=
0
;
/* nid.uCallbackMessage = ??; */
nid
.
uCallbackMessage
=
WM_ONTRAYICON
;
bRetVal
=
Shell_NotifyIcon
(
NIM_DELETE
,
&
nid
);
...
...
@@ -199,7 +199,7 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void)
nid
.
hWnd
=
hMainWnd
;
nid
.
uID
=
0
;
nid
.
uFlags
=
NIF_ICON
|
NIF_MESSAGE
|
NIF_TIP
;
/* nid.uCallbackMessage = ??; */
nid
.
uCallbackMessage
=
WM_ONTRAYICON
;
nid
.
hIcon
=
hIcon
;
wsprintf
(
nid
.
szTip
,
_T
(
"CPU Usage: %d%%"
),
PerfDataGetProcessorUsage
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment