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
43083236
Commit
43083236
authored
Feb 05, 2008
by
Kirill K. Smirnov
Committed by
Alexandre Julliard
Feb 06, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
systray: Add support for NIS_HIDDEN flag.
parent
b391b8af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
53 deletions
+82
-53
systray.c
programs/explorer/systray.c
+82
-53
No files found.
programs/explorer/systray.c
View file @
43083236
...
@@ -64,6 +64,7 @@ struct icon
...
@@ -64,6 +64,7 @@ struct icon
HWND
tooltip
;
/* Icon tooltip */
HWND
tooltip
;
/* Icon tooltip */
UINT
id
;
/* the unique id given by the app */
UINT
id
;
/* the unique id given by the app */
UINT
callback_message
;
UINT
callback_message
;
BOOL
hidden
;
/* icon display state */
};
};
static
struct
tray
tray
;
static
struct
tray
tray
;
...
@@ -182,6 +183,69 @@ static void set_tooltip(struct icon *icon, WCHAR *szTip, BOOL modify)
...
@@ -182,6 +183,69 @@ static void set_tooltip(struct icon *icon, WCHAR *szTip, BOOL modify)
SendMessageW
(
icon
->
tooltip
,
TTM_ADDTOOLW
,
0
,
(
LPARAM
)
&
ti
);
SendMessageW
(
icon
->
tooltip
,
TTM_ADDTOOLW
,
0
,
(
LPARAM
)
&
ti
);
}
}
static
BOOL
display_icon
(
struct
icon
*
icon
,
BOOL
hide
)
{
HMODULE
x11drv
=
GetModuleHandleA
(
"winex11.drv"
);
RECT
rect
;
static
const
WCHAR
adaptor_windowname
[]
=
/* Wine System Tray Adaptor */
{
'W'
,
'i'
,
'n'
,
'e'
,
' '
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
' '
,
'T'
,
'r'
,
'a'
,
'y'
,
' '
,
'A'
,
'd'
,
'a'
,
'p'
,
't'
,
'o'
,
'r'
,
0
};
static
BOOL
tooltps_initialized
=
FALSE
;
WINE_TRACE
(
"id=0x%x, hwnd=%p, hide=%d
\n
"
,
icon
->
id
,
icon
->
owner
,
hide
);
if
(
icon
->
hidden
==
hide
||
(
!
icon
->
hidden
)
==
(
!
hide
))
return
TRUE
;
icon
->
hidden
=
hide
;
if
(
hide
)
{
DestroyWindow
(
icon
->
window
);
DestroyWindow
(
icon
->
tooltip
);
return
TRUE
;
}
rect
.
left
=
0
;
rect
.
top
=
0
;
rect
.
right
=
GetSystemMetrics
(
SM_CXSMICON
)
+
ICON_BORDER
;
rect
.
bottom
=
GetSystemMetrics
(
SM_CYSMICON
)
+
ICON_BORDER
;
AdjustWindowRect
(
&
rect
,
WS_CLIPSIBLINGS
|
WS_CAPTION
,
FALSE
);
/* create the adaptor window */
icon
->
window
=
CreateWindowEx
(
0
,
adaptor_classname
,
adaptor_windowname
,
WS_CLIPSIBLINGS
|
WS_CAPTION
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
NULL
,
NULL
,
NULL
,
icon
);
if
(
x11drv
)
{
void
(
*
make_systray_window
)(
HWND
)
=
(
void
*
)
GetProcAddress
(
x11drv
,
"wine_make_systray_window"
);
if
(
make_systray_window
)
make_systray_window
(
icon
->
window
);
}
if
(
!
hide_systray
)
ShowWindow
(
icon
->
window
,
SW_SHOWNA
);
/* create icon tooltip */
/* Register tooltip classes if this is the first icon */
if
(
!
tooltps_initialized
)
{
INITCOMMONCONTROLSEX
init_tooltip
;
init_tooltip
.
dwSize
=
sizeof
(
INITCOMMONCONTROLSEX
);
init_tooltip
.
dwICC
=
ICC_TAB_CLASSES
;
InitCommonControlsEx
(
&
init_tooltip
);
tooltps_initialized
=
TRUE
;
}
icon
->
tooltip
=
CreateWindowEx
(
WS_EX_TOPMOST
,
TOOLTIPS_CLASS
,
NULL
,
WS_POPUP
|
TTS_ALWAYSTIP
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
icon
->
window
,
NULL
,
NULL
,
NULL
);
return
TRUE
;
}
static
BOOL
modify_icon
(
NOTIFYICONDATAW
*
nid
,
BOOL
modify_tooltip
)
static
BOOL
modify_icon
(
NOTIFYICONDATAW
*
nid
,
BOOL
modify_tooltip
)
{
{
struct
icon
*
icon
;
struct
icon
*
icon
;
...
@@ -196,12 +260,23 @@ static BOOL modify_icon(NOTIFYICONDATAW *nid, BOOL modify_tooltip)
...
@@ -196,12 +260,23 @@ static BOOL modify_icon(NOTIFYICONDATAW *nid, BOOL modify_tooltip)
return
FALSE
;
return
FALSE
;
}
}
if
(
nid
->
uFlags
&
NIF_STATE
)
{
if
(
nid
->
dwStateMask
&
NIS_HIDDEN
)
display_icon
(
icon
,
!!
(
nid
->
dwState
&
NIS_HIDDEN
));
else
display_icon
(
icon
,
FALSE
);
}
else
display_icon
(
icon
,
FALSE
);
if
(
nid
->
uFlags
&
NIF_ICON
)
if
(
nid
->
uFlags
&
NIF_ICON
)
{
{
if
(
icon
->
image
)
DestroyIcon
(
icon
->
image
);
if
(
icon
->
image
)
DestroyIcon
(
icon
->
image
);
icon
->
image
=
CopyIcon
(
nid
->
hIcon
);
icon
->
image
=
CopyIcon
(
nid
->
hIcon
);
RedrawWindow
(
icon
->
window
,
NULL
,
NULL
,
RDW_ERASE
|
RDW_INVALIDATE
|
RDW_UPDATENOW
);
if
(
!
icon
->
hidden
)
RedrawWindow
(
icon
->
window
,
NULL
,
NULL
,
RDW_ERASE
|
RDW_INVALIDATE
|
RDW_UPDATENOW
);
}
}
if
(
nid
->
uFlags
&
NIF_MESSAGE
)
if
(
nid
->
uFlags
&
NIF_MESSAGE
)
...
@@ -221,11 +296,7 @@ static BOOL modify_icon(NOTIFYICONDATAW *nid, BOOL modify_tooltip)
...
@@ -221,11 +296,7 @@ static BOOL modify_icon(NOTIFYICONDATAW *nid, BOOL modify_tooltip)
static
BOOL
add_icon
(
NOTIFYICONDATAW
*
nid
)
static
BOOL
add_icon
(
NOTIFYICONDATAW
*
nid
)
{
{
HMODULE
x11drv
=
GetModuleHandleA
(
"winex11.drv"
);
RECT
rect
;
struct
icon
*
icon
;
struct
icon
*
icon
;
static
const
WCHAR
adaptor_windowname
[]
=
/* Wine System Tray Adaptor */
{
'W'
,
'i'
,
'n'
,
'e'
,
' '
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
' '
,
'T'
,
'r'
,
'a'
,
'y'
,
' '
,
'A'
,
'd'
,
'a'
,
'p'
,
't'
,
'o'
,
'r'
,
0
};
static
BOOL
tooltps_initialized
=
FALSE
;
WINE_TRACE
(
"id=0x%x, hwnd=%p
\n
"
,
nid
->
uID
,
nid
->
hWnd
);
WINE_TRACE
(
"id=0x%x, hwnd=%p
\n
"
,
nid
->
uID
,
nid
->
hWnd
);
...
@@ -241,52 +312,11 @@ static BOOL add_icon(NOTIFYICONDATAW *nid)
...
@@ -241,52 +312,11 @@ static BOOL add_icon(NOTIFYICONDATAW *nid)
return
FALSE
;
return
FALSE
;
}
}
icon
->
id
=
nid
->
uID
;
icon
->
id
=
nid
->
uID
;
icon
->
owner
=
nid
->
hWnd
;
icon
->
owner
=
nid
->
hWnd
;
icon
->
image
=
NULL
;
icon
->
image
=
NULL
;
icon
->
window
=
NULL
;
rect
.
left
=
0
;
icon
->
hidden
=
TRUE
;
rect
.
top
=
0
;
rect
.
right
=
GetSystemMetrics
(
SM_CXSMICON
)
+
ICON_BORDER
;
rect
.
bottom
=
GetSystemMetrics
(
SM_CYSMICON
)
+
ICON_BORDER
;
AdjustWindowRect
(
&
rect
,
WS_CLIPSIBLINGS
|
WS_CAPTION
,
FALSE
);
/* create the adaptor window */
icon
->
window
=
CreateWindowEx
(
0
,
adaptor_classname
,
adaptor_windowname
,
WS_CLIPSIBLINGS
|
WS_CAPTION
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
NULL
,
NULL
,
NULL
,
icon
);
if
(
x11drv
)
{
void
(
*
make_systray_window
)(
HWND
)
=
(
void
*
)
GetProcAddress
(
x11drv
,
"wine_make_systray_window"
);
if
(
make_systray_window
)
make_systray_window
(
icon
->
window
);
}
if
(
!
hide_systray
)
ShowWindow
(
icon
->
window
,
SW_SHOWNA
);
/* create icon tooltip */
/* Register tooltip classes if this is the first icon */
if
(
!
tooltps_initialized
)
{
INITCOMMONCONTROLSEX
init_tooltip
;
init_tooltip
.
dwSize
=
sizeof
(
INITCOMMONCONTROLSEX
);
init_tooltip
.
dwICC
=
ICC_TAB_CLASSES
;
InitCommonControlsEx
(
&
init_tooltip
);
tooltps_initialized
=
TRUE
;
}
icon
->
tooltip
=
CreateWindowEx
(
WS_EX_TOPMOST
,
TOOLTIPS_CLASS
,
NULL
,
WS_POPUP
|
TTS_ALWAYSTIP
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
icon
->
window
,
NULL
,
NULL
,
NULL
);
list_add_tail
(
&
tray
.
icons
,
&
icon
->
entry
);
list_add_tail
(
&
tray
.
icons
,
&
icon
->
entry
);
...
@@ -305,8 +335,7 @@ static BOOL delete_icon(const NOTIFYICONDATAW *nid)
...
@@ -305,8 +335,7 @@ static BOOL delete_icon(const NOTIFYICONDATAW *nid)
return
FALSE
;
return
FALSE
;
}
}
DestroyWindow
(
icon
->
tooltip
);
display_icon
(
icon
,
TRUE
);
DestroyWindow
(
icon
->
window
);
return
TRUE
;
return
TRUE
;
}
}
...
...
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