lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Use wxWidgets support for safely showing message boxes


From: Vadim Zeitlin
Subject: Re: [lmi] Use wxWidgets support for safely showing message boxes
Date: Thu, 23 Feb 2023 01:00:24 +0100

On Wed, 22 Feb 2023 22:33:43 +0000 Greg Chicares <gchicares@sbcglobal.net> 
wrote:

GC> On 2/17/23 18:29, Vadim Zeitlin wrote:
GC> > 
GC> >  PR 228[1], corresponding to xanadu/safe-show-message branch, contains
GC> > another proposed change, which can be applied even to the current master,
GC> > as the required functionality is already part of the version of wxWidgets
GC> > currently being used, but which I've tested with wx 3.2.2.1, i.e. as if 
the
GC> > PR 226 and/or 227 were already applied.
GC> 
GC> Applying these all together

 First of all, thanks for applying them!

GC> and running the pc-linux-gnu binary with '--ash_nazg', I try:
GC>   Test | Test alerts from shared library | Test catastrophe report
GC> Result: "Test catastrophe report." prints on the console, and no
GC> message box appears. Is that the intention?

 No, sorry, I just overlooked this function (as it was in a different file
from the one I was looking at...), so I can't say I've intentionally done
anything at all here.

GC> IOW, in this function:
GC> 
GC> void report_catastrophe(char const* message)
GC> {
GC>     safely_show_on_stderr(message);
GC> #if defined LMI_MSW
GC>     ::MessageBoxA
GC>         (nullptr
GC>         ,message
GC>         ,"Catastrophic error"
GC>         ,MB_OK | MB_SETFOREGROUND | MB_ICONHAND | MB_SYSTEMMODAL
GC>         );
GC> #endif // defined LMI_MSW
GC> }
GC> 
GC> can we write an "#else if defined LMI_POSIX && defined __WXGTK__"
GC> clause that pops up a GUI message box even if wx or GTK has
GC> not yet been initialized?

 Sorry if I'm missing something, but there is no way to show a message box
without using GTK (or another graphical toolkit) under Linux, so no, I
don't think so. I.e. even if we were ready to use X11 directly, we'd still
need an open connection to an X11 display (and it's not specific to X11,
even though the terminology is different, it's conceptually the same thing
with Wayland too). We could, in theory, ask another program, via some kind
of IPC, or another shared library, to show the message box for us, but we
don't have anything like this at the moment and I'm not sure if it's
something people would really expect a "console" application to do.

 This looks like a chicken and egg problem to me: we need wx to show the
message box, but this function is only [supposed to be] used when wx is not
available, so it does seem like it can't use it, almost by definition.

 But please let me know if I do miss something here,
VZ

Attachment: pgpNONNehKso6.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]