Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
83f34aa4
Commit
83f34aa4
authored
May 31, 2015
by
Steve Dower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #24293: Adds mapping from explicit colours to system colours to correctly handle user themes.
parent
4640b300
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
12 deletions
+59
-12
Tools/msi/bundle/Default.thm
Tools/msi/bundle/Default.thm
+7
-7
Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
+52
-5
No files found.
Tools/msi/bundle/Default.thm
View file @
83f34aa4
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Theme
xmlns=
"http://wixtoolset.org/schemas/thmutil/2010"
>
<Theme
xmlns=
"http://wixtoolset.org/schemas/thmutil/2010"
>
<Window
Background=
"ffff00"
Width=
"640"
Height=
"382"
HexStyle=
"100a0000"
FontId=
"0"
>
#(loc.Caption)
</Window>
<Window
Width=
"640"
Height=
"382"
HexStyle=
"100a0000"
FontId=
"0"
>
#(loc.Caption)
</Window>
<Font
Id=
"0"
Height=
"-12"
Weight=
"500"
>
Segoe UI
</Font>
<Font
Id=
"0"
Height=
"-12"
Weight=
"500"
Foreground=
"000000"
Background=
"ffffff"
>
Segoe UI
</Font>
<Font
Id=
"1"
Height=
"-24"
Weight=
"500"
>
Segoe UI
</Font>
<Font
Id=
"1"
Height=
"-24"
Weight=
"500"
Foreground=
"000000"
Background=
"ffffff"
>
Segoe UI
</Font>
<Font
Id=
"2"
Height=
"-22"
Weight=
"500"
Foreground=
"
666666
"
>
Segoe UI
</Font>
<Font
Id=
"2"
Height=
"-22"
Weight=
"500"
Foreground=
"
808080"
Background=
"ffffff
"
>
Segoe UI
</Font>
<Font
Id=
"3"
Height=
"-12"
Weight=
"500"
>
Segoe UI
</Font>
<Font
Id=
"3"
Height=
"-12"
Weight=
"500"
Foreground=
"000000"
Background=
"ffffff"
>
Segoe UI
</Font>
<Font
Id=
"4"
Height=
"-12"
Weight=
"500"
Foreground=
"ff0000"
Underline=
"yes"
>
Segoe UI
</Font>
<Font
Id=
"4"
Height=
"-12"
Weight=
"500"
Foreground=
"ff0000"
Background=
"ffffff"
Underline=
"yes"
>
Segoe UI
</Font>
<Font
Id=
"5"
Height=
"-12"
Weight=
"500"
Foreground=
"
666666
"
>
Segoe UI
</Font>
<Font
Id=
"5"
Height=
"-12"
Weight=
"500"
Foreground=
"
808080"
Background=
"ffffff
"
>
Segoe UI
</Font>
<Page
Name=
"Help"
>
<Page
Name=
"Help"
>
<Text
X=
"185"
Y=
"11"
Width=
"-11"
Height=
"32"
FontId=
"1"
DisablePrefix=
"yes"
>
#(loc.HelpHeader)
</Text>
<Text
X=
"185"
Y=
"11"
Width=
"-11"
Height=
"32"
FontId=
"1"
DisablePrefix=
"yes"
>
#(loc.HelpHeader)
</Text>
...
...
Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
View file @
83f34aa4
...
@@ -1475,6 +1475,8 @@ private:
...
@@ -1475,6 +1475,8 @@ private:
POINT
ptCursor
=
{
};
POINT
ptCursor
=
{
};
HMONITOR
hMonitor
=
nullptr
;
HMONITOR
hMonitor
=
nullptr
;
MONITORINFO
mi
=
{
};
MONITORINFO
mi
=
{
};
COLORREF
fg
,
bg
;
HBRUSH
bgBrush
;
// If the theme did not provide an icon, try using the icon from the bundle engine.
// If the theme did not provide an icon, try using the icon from the bundle engine.
if
(
!
hIcon
)
{
if
(
!
hIcon
)
{
...
@@ -1484,12 +1486,23 @@ private:
...
@@ -1484,12 +1486,23 @@ private:
}
}
}
}
fg
=
RGB
(
0
,
0
,
0
);
bg
=
RGB
(
255
,
255
,
255
);
bgBrush
=
(
HBRUSH
)(
COLOR_WINDOW
+
1
);
if
(
_theme
->
dwFontId
<
_theme
->
cFonts
)
{
THEME_FONT
*
font
=
&
_theme
->
rgFonts
[
_theme
->
dwFontId
];
fg
=
font
->
crForeground
;
bg
=
font
->
crBackground
;
bgBrush
=
font
->
hBackground
;
RemapColor
(
&
fg
,
&
bg
,
&
bgBrush
);
}
// Register the window class and create the window.
// Register the window class and create the window.
wc
.
lpfnWndProc
=
PythonBootstrapperApplication
::
WndProc
;
wc
.
lpfnWndProc
=
PythonBootstrapperApplication
::
WndProc
;
wc
.
hInstance
=
_hModule
;
wc
.
hInstance
=
_hModule
;
wc
.
hIcon
=
hIcon
;
wc
.
hIcon
=
hIcon
;
wc
.
hCursor
=
::
LoadCursorW
(
nullptr
,
(
LPCWSTR
)
IDC_ARROW
);
wc
.
hCursor
=
::
LoadCursorW
(
nullptr
,
(
LPCWSTR
)
IDC_ARROW
);
wc
.
hbrBackground
=
(
HBRUSH
)(
COLOR_WINDOW
+
1
)
;
wc
.
hbrBackground
=
bgBrush
;
wc
.
lpszMenuName
=
nullptr
;
wc
.
lpszMenuName
=
nullptr
;
wc
.
lpszClassName
=
PYBA_WINDOW_CLASS
;
wc
.
lpszClassName
=
PYBA_WINDOW_CLASS
;
if
(
!::
RegisterClassW
(
&
wc
))
{
if
(
!::
RegisterClassW
(
&
wc
))
{
...
@@ -1704,12 +1717,12 @@ private:
...
@@ -1704,12 +1717,12 @@ private:
}
}
break
;
break
;
case
WM_CTLCOLORSTATIC
:
case
WM_CTLCOLORBTN
:
case
WM_CTLCOLORBTN
:
if
(
pBA
)
{
if
(
pBA
)
{
HWND
button
=
(
HWND
)
lParam
;
HBRUSH
brush
=
nullptr
;
DWORD
style
=
GetWindowLong
(
button
,
GWL_STYLE
)
&
BS_TYPEMASK
;
if
(
pBA
->
SetControlColor
((
HWND
)
lParam
,
(
HDC
)
wParam
,
&
brush
))
{
if
(
style
==
BS_COMMANDLINK
||
style
==
BS_DEFCOMMANDLINK
)
{
return
(
LRESULT
)
brush
;
return
(
LRESULT
)
pBA
->
_theme
->
rgFonts
[
pBA
->
_theme
->
dwFontId
].
hBackground
;
}
}
}
}
break
;
break
;
...
@@ -1782,6 +1795,40 @@ private:
...
@@ -1782,6 +1795,40 @@ private:
return
SUCCEEDED
(
hr
);
return
SUCCEEDED
(
hr
);
}
}
void
RemapColor
(
COLORREF
*
fg
,
COLORREF
*
bg
,
HBRUSH
*
bgBrush
)
{
if
(
*
fg
==
RGB
(
0
,
0
,
0
))
{
*
fg
=
GetSysColor
(
COLOR_WINDOWTEXT
);
}
else
if
(
*
fg
==
RGB
(
128
,
128
,
128
))
{
*
fg
=
GetSysColor
(
COLOR_GRAYTEXT
);
}
if
(
*
bgBrush
&&
*
bg
==
RGB
(
255
,
255
,
255
))
{
*
bg
=
GetSysColor
(
COLOR_WINDOW
);
*
bgBrush
=
GetSysColorBrush
(
COLOR_WINDOW
);
}
}
BOOL
SetControlColor
(
HWND
hWnd
,
HDC
hDC
,
HBRUSH
*
brush
)
{
for
(
int
i
=
0
;
i
<
_theme
->
cControls
;
++
i
)
{
if
(
_theme
->
rgControls
[
i
].
hWnd
!=
hWnd
)
{
continue
;
}
DWORD
fontId
=
_theme
->
rgControls
[
i
].
dwFontId
;
if
(
fontId
>
_theme
->
cFonts
)
{
fontId
=
0
;
}
THEME_FONT
*
fnt
=
&
_theme
->
rgFonts
[
fontId
];
COLORREF
fg
=
fnt
->
crForeground
,
bg
=
fnt
->
crBackground
;
*
brush
=
fnt
->
hBackground
;
RemapColor
(
&
fg
,
&
bg
,
brush
);
SetTextColor
(
hDC
,
fg
);
SetBkColor
(
hDC
,
bg
);
return
TRUE
;
}
return
FALSE
;
}
//
//
// OnShowFailure - display the failure page.
// OnShowFailure - display the failure page.
...
...
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