Re: [AD] allegro_message under X

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> 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);
 }
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/