Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  Change the taskbar api to be forward compat
  Add a default manifest for windows
  Remove potential lag from mnesia_log:log/slog functions
  • Loading branch information
dgud committed Dec 9, 2020
2 parents 83a1345 + 1e47980 commit feb7c78
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 32 deletions.
4 changes: 0 additions & 4 deletions erts/emulator/sys/win32/erl_win_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
#include <fcntl.h>
#include <time.h>
#include <sys/timeb.h>
#pragma comment(linker,"/manifestdependency:\"type='win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' processorArchitecture='*' "\
"publicKeyToken='6595b64144ccf1df' language='*'\"")

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
Expand Down
5 changes: 1 addition & 4 deletions erts/etc/win32/erl.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
*
* %CopyrightEnd%
*/
#pragma comment(linker,"/manifestdependency:\"type='win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' processorArchitecture='*' "\
"publicKeyToken='6595b64144ccf1df' language='*'\"")

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
17 changes: 17 additions & 0 deletions erts/etc/win32/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="AsInvoker" uiAccess="false"></ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>
</assembly>
5 changes: 0 additions & 5 deletions erts/etc/win32/win_erlexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
* Most of this only used when beam is run as a separate process.
*/

#pragma comment(linker,"/manifestdependency:\"type='win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' processorArchitecture='*' "\
"publicKeyToken='6595b64144ccf1df' language='*'\"")

#include <windows.h>
#include <winuser.h>
#include <wincon.h>
Expand Down
10 changes: 7 additions & 3 deletions erts/etc/win32/wsl_tools/vc/ld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,16 @@ RES=$?

CMANIFEST=`w32_path.sh -u $MANIFEST`

if [ "$RES" = "0" -a -f "$CMANIFEST" ]; then
# Add stuff to manifest to turn off "virtualization"
if [ -f "$CMANIFEST" ]; then
## Add stuff to manifest to turn off "virtualization"
sed -n -i '1h;1!H;${;g;s,<trustInfo.*</trustInfo>.,,g;p;}' $CMANIFEST 2>/dev/null
sed -i "s/<\/assembly>/ <ms_asmv2:trustInfo xmlns:ms_asmv2=\"urn:schemas-microsoft-com:asm.v2\">\n <ms_asmv2:security>\n <ms_asmv2:requestedPrivileges>\n <ms_asmv2:requestedExecutionLevel level=\"AsInvoker\" uiAccess=\"false\"\/>\n <\/ms_asmv2:requestedPrivileges>\n <\/ms_asmv2:security>\n <\/ms_asmv2:trustInfo>\n<\/assembly>/" $CMANIFEST 2>/dev/null
else
CMANIFEST=$ERL_TOP/erts/etc/win32/manifest.xml
MANIFEST=`w32_path.sh -d $CMANIFEST`
fi

if [ "$RES" = "0" ]; then
eval mt.exe -nologo -manifest "$MANIFEST" -outputresource:"$OUTPUTRES" >>/tmp/link.exe.${p}.1 2>>/tmp/link.exe.${p}.2
RES=$?
if [ "$RES" != "0" ]; then
Expand All @@ -192,7 +197,6 @@ if [ "$RES" = "0" -a -f "$CMANIFEST" ]; then
echo "If you get this error, make sure Windows Defender AND Windows Search is disabled">>/tmp/link.exe.${p}.1
rm -f "$CREMOVE"
fi
rm -f "$CMANIFEST"
fi

# This works around some strange behaviour
Expand Down
5 changes: 4 additions & 1 deletion lib/mnesia/src/mnesia_dumper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ incr_log_writes() ->
Left = mnesia_lib:incr_counter(trans_log_writes_left, -1),
if
Left =:= 0 ->
adjust_log_writes(true);
%% It doesn't matter which process adjusts counters and sends
%% cast to a dumper so to avoid potential lag on global:set_lock
%% we delegate it to new process
spawn(fun() -> adjust_log_writes(true) end);
true ->
ignore
end.
Expand Down
15 changes: 9 additions & 6 deletions lib/wx/api_gen/wx_extra/wxTaskBarIcon.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ new() ->
%% <pre>Callback() -> term()</pre>
%%
%% See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxtaskbaricon.html#wxtaskbariconwxtaskbaricon">external documentation</a>.
-spec new(function()) -> wxTaskBarIcon().
new(F) when is_function(F)->
Fun = fun([_]) ->
#wx_ref{type=wxMenu,ref=ThisRef} = F(),
<<ThisRef:32/?UI>>
end,
-spec new([Option]) -> wxTaskBarIcon() when
Option :: {'createPopupMenu', fun(() -> wxMenu:wxMenu())}.
new([]) ->
new();
new([{createPopupMenu, F}]) when is_function(F) ->
Fun = fun([_]) ->
#wx_ref{type=wxMenu,ref=ThisRef} = F(),
<<ThisRef:32/?UI>>
end,
BinFun = <<(wxe_util:get_cbId(Fun)):32/?UI, 0:32>>,
wxe_util:construct(?wxTaskBarIcon_new, BinFun).
wxTaskBarIcon_new>>
4 changes: 1 addition & 3 deletions lib/wx/examples/simple/menu.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@
start() ->
Wx = wx:new(),
Frame = wx:batch(fun() -> create_frame(Wx) end),
Taskbar = wxTaskBarIcon:new(fun() ->
create_dummy_menu()
end),
Taskbar = wxTaskBarIcon:new([{createPopupMenu, fun() -> create_dummy_menu() end}]),
wxWindow:show(Frame),
Path = filename:dirname(code:which(?MODULE)),
wxTaskBarIcon:setIcon(Taskbar, wxIcon:new(filename:join(Path,"sample.xpm"), [{type, ?wxBITMAP_TYPE_XPM}])),
Expand Down
15 changes: 9 additions & 6 deletions lib/wx/src/gen/wxTaskBarIcon.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ new() ->
%% <pre>Callback() -> term()</pre>
%%
%% See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxtaskbaricon.html#wxtaskbariconwxtaskbaricon">external documentation</a>.
-spec new(function()) -> wxTaskBarIcon().
new(F) when is_function(F)->
Fun = fun([_]) ->
#wx_ref{type=wxMenu,ref=ThisRef} = F(),
<<ThisRef:32/?UI>>
end,
-spec new([Option]) -> wxTaskBarIcon() when
Option :: {'createPopupMenu', fun(() -> wxMenu:wxMenu())}.
new([]) ->
new();
new([{createPopupMenu, F}]) when is_function(F) ->
Fun = fun([_]) ->
#wx_ref{type=wxMenu,ref=ThisRef} = F(),
<<ThisRef:32/?UI>>
end,
BinFun = <<(wxe_util:get_cbId(Fun)):32/?UI, 0:32>>,
wxe_util:construct(?wxTaskBarIcon_new, BinFun).
%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxtaskbaricon.html#wxtaskbariconpopupmenu">external documentation</a>.
Expand Down

0 comments on commit feb7c78

Please sign in to comment.