Re: [AD] allegro_message under X |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] allegro_message under X
- From: Elias Pschernig <allefant@xxxxxxxxxx>
- Date: Sat, 23 Oct 2004 19:32:23 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=WmZg9AjR9YR0GhHWwAg8NG5LPP/SkTFbCaGukJZVl431ZXEg/sQFjTXk482n5Dc/pthE97G3A0uotohfRWm3uP2VxW5j4Q/HwEMO22nod1PKqapdlajxaPQtuS7JhI7VJWmFUApEUdl8KlyF18lwhIZ4GfBt17+9c+5DOjheLGo=
> Ok, here is a patch that implements what I have proposed. Basically,
> allegro_message under X now tries to use kdialog, gdialog and xmessage, in
> that order. If none is available, it falls back to stdout.
>
> This was more complicated than I expected, because the message to display must
> be put in a form that won't confuse the shell (think metacharacters). Right
> now, I put the message between double quotes, and escape with a backslash the
> characters (&) (!) (") and (\). I don't know if this is enough.
>
> All in all, the patch seems to work, but it's not perfect:
>
> 1. the demo's ending message looks like crap with kdialog :-). This is
> because lines are broken twice (explicitly by the demo, and then
> automatically by kdialog). Not much can be done here.
>
It looks fine with xmessage. Btw, I think "gdialog" is actually called
"gtk-shell". But the only difference is that the "Ok" button follows
the theme. Same for kdialog I assume. So maybe we should just always
use xmessage? I mean, given it is an Allegro program which definitely
won't follow neither Qt nor GTK theme - I think having proper line
breaks is more important than the look of the OK button.
> I suppose the window is needed for keyboard input, but maybe it could be
> hidden by set_gfx_mode(GFX_TEXT), or made very small... ?
>
Hm. Yes, this indeed is bad. I think, GFX_TEXT should hide the window.
Does the attached patch work for you?
Index: src/x/xwin.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xwin.c,v
retrieving revision 1.73
diff -u -p -r1.73 xwin.c
--- src/x/xwin.c 25 Sep 2004 08:33:31 -0000 1.73
+++ src/x/xwin.c 23 Oct 2004 17:31:17 -0000
@@ -2139,6 +2139,7 @@ static void _xwin_private_set_window_def
#endif
XSetWMHints(_xwin.display, _xwin.window, &wm_hints);
+ XUnmapWindow (_xwin.display, _xwin.window);
}