Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0245-wx-Filter-gtk-error-msgs.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0245-wx-Filter-gtk-error-msgs.patch of Package erlang
From d978b4b08ab61c6df3477799bfc615d43271675b Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson <dgud@erlang.org> Date: Fri, 25 Feb 2022 16:45:54 +0100 Subject: [PATCH 2/2] wx: Filter gtk error msgs --- lib/wx/c_src/Makefile.in | 14 +++++++------- lib/wx/c_src/wxe_impl.cpp | 25 +++++++++++++++++++++++++ lib/wx/configure | 14 ++++++++++++-- lib/wx/configure.ac | 12 ++++++++++-- lib/wx/src/wx.app.src | 2 +- lib/wx/src/wxe_master.erl | 13 +++++++------ lib/wx/src/wxe_server.erl | 4 ++-- lib/wx/src/wxe_util.erl | 2 +- 8 files changed, 65 insertions(+), 21 deletions(-) diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in index 93b1bffb81..87fc0354b6 100644 --- a/lib/wx/c_src/Makefile.in +++ b/lib/wx/c_src/Makefile.in @@ -97,25 +97,25 @@ RESCOMP = @WX_RESCOMP@ ifeq (@WX_HAVE_STATIC_LIBS@,true) OPT_WX_LIBS = @WX_LIBS_STATIC@ -DEBUG_WX_LIBS = @DEBUG_WX_LIBS_STATIC@ +DEBUG_WX_LIBS = @DEBUG_WX_LIBS_STATIC@ @GLIB_LIBS@ else -OPT_WX_LIBS = @WX_LIBS@ -DEBUG_WX_LIBS = @DEBUG_WX_LIBS@ +OPT_WX_LIBS = @WX_LIBS@ @GLIB_LIBS@ +DEBUG_WX_LIBS = @DEBUG_WX_LIBS@ @GLIB_LIBS@ endif ifeq ($(TYPE),debug) WX_CFLAGS = @DEBUG_WX_CFLAGS@ CFLAGS = @DEBUG_CFLAGS@ WX_CXX_FLAGS = @DEBUG_WX_CXXFLAGS@ -CXX_FLAGS = @DEBUG_CXXFLAGS@ -CXX_NO_OPT_FLAGS = @DEBUG_CXXFLAGS@ +CXX_FLAGS = @DEBUG_CXXFLAGS@ @GLIB_CFLAGS@ +CXX_NO_OPT_FLAGS = @DEBUG_CXXFLAGS@ @GLIB_CFLAGS@ WX_LIBS = $(DEBUG_WX_LIBS) else WX_CFLAGS = @WX_CFLAGS@ CFLAGS = @CFLAGS@ WX_CXX_FLAGS = @WX_CXXFLAGS@ -CXX_FLAGS = @CXXFLAGS@ -CXX_NO_OPT_FLAGS = @CXXNOOPTFLAGS@ +CXX_FLAGS = @CXXFLAGS@ @GLIB_CFLAGS@ +CXX_NO_OPT_FLAGS = @CXXNOOPTFLAGS@ @GLIB_CFLAGS@ WX_LIBS = $(OPT_WX_LIBS) endif diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp index 1eae766c6d..57a0e40173 100644 --- a/lib/wx/c_src/wxe_impl.cpp +++ b/lib/wx/c_src/wxe_impl.cpp @@ -33,6 +33,10 @@ #include <wx/dcbuffer.h> #undef private +#ifdef HAVE_GLIB + #include <glib.h> +#endif + #include "wxe_impl.h" #include "wxe_events.h" #include "wxe_return.h" @@ -135,6 +139,23 @@ void print_cmd(wxeCommand& event) * Init WxeApp the application emulator * ************************************************************/ +#ifdef HAVE_GLIB +static GLogWriterOutput wxe_log_glib(GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields, + gpointer user_data) +{ + for (gsize i = 0; i < n_fields; i++) { + if(strcmp(fields[i].key, "MESSAGE") == 0) { + wxString msg; + msg.Printf(wxT("GTK: %s"), (char *) fields[i].value); + send_msg("debug", &msg); + } + } + return G_LOG_WRITER_HANDLED; +} +#endif + bool WxeApp::OnInit() { @@ -167,6 +188,10 @@ bool WxeApp::OnInit() (wxObjectEventFunction) (wxEventFunction) &WxeApp::dummy_close); #endif +#ifdef HAVE_GLIB + g_log_set_writer_func(wxe_log_glib, NULL, NULL); +#endif + SetExitOnFrameDelete(false); enif_mutex_lock(wxe_status_m); diff --git a/lib/wx/configure b/lib/wx/configure index 8988bb0dc1..0f8e3e3d8e 100755 --- a/lib/wx/configure +++ b/lib/wx/configure @@ -682,6 +682,8 @@ DEBUG_CFLAGS GL_LIBS OBJC_CFLAGS OBJC_CC +GLIB_LIBS +GLIB_CFLAGS EGREP GREP MIXED_MINGW @@ -4436,13 +4436,22 @@ printf "%s\n" "$as_me: WARNING: Reverting to 32-bit time_t" >&2;} CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600" ;; *) - CFLAGS="$CFLAGS -Wno-deprecated-declarations" - CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE $PTHR_CFLAGS" + + GLIB_CFLAGS=`pkg-config --silence-errors --cflags glib-2.0` + GLIB_LIBS=`pkg-config --silence-errors --libs glib-2.0` + if test X"$GLIB_CFLAGS" != X ; then + HAVE_GLIB="-DHAVE_GLIB=1" + fi + CFLAGS="$CFLAGS -Wno-deprecated-declarations" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE $PTHR_CFLAGS $HAVE_GLIB" ;; esac + + + case $host_os in darwin*) diff --git a/lib/wx/configure.in b/lib/wx/configure.in index cea4fa1e3b..ca54556fbd 100644 --- a/lib/wx/configure.in +++ b/lib/wx/configure.in @@ -189,11 +189,19 @@ case $host_os in CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600" ;; *) - CFLAGS="$CFLAGS -Wno-deprecated-declarations" - CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE $PTHR_CFLAGS" + GLIB_CFLAGS=`pkg-config --silence-errors --cflags glib-2.0` + GLIB_LIBS=`pkg-config --silence-errors --libs glib-2.0` + if test X"$GLIB_CFLAGS" != X ; then + HAVE_GLIB="-DHAVE_GLIB=1" + fi + CFLAGS="$CFLAGS -Wno-deprecated-declarations" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE $PTHR_CFLAGS $HAVE_GLIB" ;; esac +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + AC_SUBST(OBJC_CC) AC_SUBST(OBJC_CFLAGS) diff --git a/lib/wx/src/wx.app.src b/lib/wx/src/wx.app.src index f814709a96..7475edfdde 100644 --- a/lib/wx/src/wx.app.src +++ b/lib/wx/src/wx.app.src @@ -35,5 +35,5 @@ {registered, []}, {applications, [stdlib, kernel]}, {env, []}, - {runtime_dependencies, ["stdlib-3.13","kernel-3.0","erts-6.0"]} + {runtime_dependencies, ["stdlib-3.15","kernel-8.0","erts-12.0"]} ]}. diff --git a/lib/wx/src/wxe_master.erl b/lib/wx/src/wxe_master.erl index e2f22f6769..5724457ae7 100644 --- a/lib/wx/src/wxe_master.erl +++ b/lib/wx/src/wxe_master.erl @@ -123,7 +123,8 @@ init([SilentStart]) -> wxe_util:setup_consts(), {ok, #state{}} catch _:Error:ST -> - io:format("Error: ~p @ ~p~n",[Error, ST]), + Str = io_lib:format("Error: ~p @ ~p~n",[Error, ST]), + logger:log(error, Str, #{domain => [wx]}), error({error, {Error, "Could not initiate graphics"}}) end. @@ -167,13 +168,13 @@ handle_cast(_Msg, State) -> %% Description: Handling all non call/cast messages %%-------------------------------------------------------------------- handle_info({wxe_driver, error, Msg}, State) -> - error_logger:error_report([{wx, error}, {message, lists:flatten(Msg)}]), + logger:log(error, "wx: ~s", [Msg], #{domain => [wx]}), {noreply, State}; handle_info({wxe_driver, internal_error, Msg}, State) -> - error_logger:error_report([{wx, internal_error}, {message, lists:flatten(Msg)}]), + logger:log(error, "wx: ~s", [Msg], #{domain => [wx]}), {noreply, State}; handle_info({wxe_driver, debug, Msg}, State) -> - io:format("WX DBG: ~s~n", [Msg]), + logger:log(notice, "wx: ~s", [Msg], #{domain => [wx]}), {noreply, State}; handle_info({wxe_driver, Cmd, File}, State = #state{subscribers=Subs, msgs=Msgs}) when Cmd =:= open_file; Cmd =:= new_file; Cmd =:= print_file; @@ -183,8 +184,8 @@ handle_info({wxe_driver, Cmd, File}, State = #state{subscribers=Subs, msgs=Msgs} handle_info({'DOWN', _Ref, process, Pid, _Info}, State) -> Subs = State#state.subscribers -- [Pid], {noreply, State#state{subscribers=Subs}}; -handle_info(_Info, State) -> - io:format("Unknown message ~p sent to ~p~n",[_Info, ?MODULE]), +handle_info(Info, State) -> + logger:log(notice, "wx: Unexpected Msg: ~p", [Info], #{domain => [wx], line=>?LINE, file=>?MODULE_STRING}), {noreply, State}. %%-------------------------------------------------------------------- diff --git a/lib/wx/src/wxe_server.erl b/lib/wx/src/wxe_server.erl index 4cef311bb3..4a8e9f6c4f 100644 --- a/lib/wx/src/wxe_server.erl +++ b/lib/wx/src/wxe_server.erl @@ -41,7 +41,7 @@ %%-record(event, {object, callback, cb_handler}). -define(APPLICATION, wxe). --define(log(S,A), log(?MODULE,?LINE,S,A)). +-define(log(S,A), log(?MODULE_STRING,?LINE,S,A)). -include("wxe.hrl"). -include("../include/wx.hrl"). @@ -210,7 +210,7 @@ code_change(_OldVsn, State, _Extra) -> %%-------------------------------------------------------------------- log(Mod,Line,Str,Args) -> - error_logger:format("~p:~p: " ++ Str, [Mod,Line|Args]). + logger:log(error, Str, Args, #{domain => [wx], file=>Mod, line=>Line}). handle_connect(Object, #evh{handler=undefined, cb=Callback} = EvData0, From, State0) -> diff --git a/lib/wx/src/wxe_util.erl b/lib/wx/src/wxe_util.erl index 1e72f39057..d50d68003f 100644 --- a/lib/wx/src/wxe_util.erl +++ b/lib/wx/src/wxe_util.erl @@ -190,6 +190,6 @@ strip([H|R], Src) -> [H| strip(R, Src)]. opt_error_log(false, Format, Args) -> - error_logger:format(Format, Args); + logger:log(error, Format, Args, #{domain => [wx]}); opt_error_log(true, _Format, _Args) -> ok. -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor