First off, hopefully you are at least running Allegro 4.4. But even then, I would highly recommend switching to the 5.0 series. Version 4 is essentially past end-of-life, and as operating systems change, it becomes less likely to work reliably.
That said, you could try explicitly calling set_gfx_mode(GFX_TEXT, 0, 0, 0, 0)
to try to cleanly exit the full screen.
Also, you'll have the fewest problems if you set the same mode as the desktop. e.g.:
int w, h;
get_desktop_resolution(&w, &h);
set_color_depth(desktop_color_depth());
set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, w, h, 0, 0);
And perhaps GFX_XWINDOWS_FULLSCREEN
will work better. Or maybe GFX_XDGA2
running with root permissions. If all that fails, you're likely stuck using windowed mode.