- fixed compilation problems in fbdev DGA code

- nicer "about" dialog in GTK prefs editor
- display refresh is inhibited during mode switch if !HAVE_PTHREADS
This commit is contained in:
cebix 2001-06-30 20:18:36 +00:00
parent b0b21f7fe6
commit a3ea4f3ead
2 changed files with 31 additions and 20 deletions

View File

@ -227,13 +227,21 @@ static void mn_about(...)
{ {
GtkWidget *dialog, *label, *button; GtkWidget *dialog, *label, *button;
char str[256]; char str[512];
sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); sprintf(str,
strncat(str, "\n", 255); "Basilisk II\nVersion %d.%d\n\n"
strncat(str, GetString(STR_ABOUT_TEXT2), 255); "Copyright (C) 1997-2001 Christian Bauer et al.\n"
"E-mail: Christian.Bauer@uni-mainz.de\n"
"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n"
"Basilisk II comes with ABSOLUTELY NO\n"
"WARRANTY. This is free software, and\n"
"you are welcome to redistribute it\n"
"under the terms of the GNU General\n"
"Public License.\n",
VERSION_MAJOR, VERSION_MINOR
);
dialog = gtk_dialog_new(); dialog = gtk_dialog_new();
gtk_widget_set_usize(GTK_WIDGET(dialog), strlen(GetString(STR_ABOUT_TEXT2)) + 200, 120);
gtk_window_set_title(GTK_WINDOW(dialog), GetString(STR_ABOUT_TITLE)); gtk_window_set_title(GTK_WINDOW(dialog), GetString(STR_ABOUT_TITLE));
gtk_container_border_width(GTK_CONTAINER(dialog), 5); gtk_container_border_width(GTK_CONTAINER(dialog), 5);
gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150); gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150);

View File

@ -87,8 +87,8 @@ static bool local_X11; // Flag: X server running on local machine?
static uint8 *the_buffer = NULL; // Mac frame buffer (where MacOS draws into) static uint8 *the_buffer = NULL; // Mac frame buffer (where MacOS draws into)
static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer (for refreshed modes) static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer (for refreshed modes)
#ifdef HAVE_PTHREADS
static bool redraw_thread_active = false; // Flag: Redraw thread installed static bool redraw_thread_active = false; // Flag: Redraw thread installed
#ifdef HAVE_PTHREADS
static volatile bool redraw_thread_cancel; // Flag: Cancel Redraw thread static volatile bool redraw_thread_cancel; // Flag: Cancel Redraw thread
static pthread_t redraw_thread; // Redraw thread static pthread_t redraw_thread; // Redraw thread
#endif #endif
@ -345,15 +345,15 @@ driver_base::driver_base()
driver_base::~driver_base() driver_base::~driver_base()
{ {
XFlush(x_display);
XSync(x_display, false);
if (w) { if (w) {
XUnmapWindow(x_display, w); XUnmapWindow(x_display, w);
wait_unmapped(w); wait_unmapped(w);
XDestroyWindow(x_display, w); XDestroyWindow(x_display, w);
} }
XFlush(x_display);
XSync(x_display, false);
// Free frame buffer(s) // Free frame buffer(s)
if (!use_vosf) { if (!use_vosf) {
if (the_buffer) { if (the_buffer) {
@ -446,7 +446,7 @@ driver_window::driver_window(const video_mode &mode)
wait_mapped(w); wait_mapped(w);
// Try to create and attach SHM image // Try to create and attach SHM image
if (local_X11 && mode.depth != VDEPTH_1BIT && XShmQueryExtension(x_display)) { if (local_X11 && XShmQueryExtension(x_display)) {
// Create SHM image ("height + 2" for safety) // Create SHM image ("height + 2" for safety)
img = XShmCreateImage(x_display, vis, mode.depth == VDEPTH_1BIT ? 1 : xdepth, mode.depth == VDEPTH_1BIT ? XYBitmap : ZPixmap, 0, &shminfo, width, height); img = XShmCreateImage(x_display, vis, mode.depth == VDEPTH_1BIT ? 1 : xdepth, mode.depth == VDEPTH_1BIT ? XYBitmap : ZPixmap, 0, &shminfo, width, height);
@ -659,14 +659,13 @@ void driver_dga::resume(void)
* fbdev DGA display driver * fbdev DGA display driver
*/ */
const char FBDEVICES_FILE_NAME[] = DATADIR "/fbdevices";
const char FBDEVICE_FILE_NAME[] = "/dev/fb";
class driver_fbdev : public driver_dga { class driver_fbdev : public driver_dga {
public: public:
driver_fbdev(const video_mode &mode); driver_fbdev(const video_mode &mode);
~driver_fbdev(); ~driver_fbdev();
private:
const char FBDEVICES_FILE_NAME[] = DATADIR "/fbdevices";
const char FBDEVICE_FILE_NAME[] = "/dev/fb";
}; };
// Open display // Open display
@ -799,7 +798,7 @@ driver_fbdev::driver_fbdev(const video_mode &mode)
// Set VideoMonitor // Set VideoMonitor
VideoModes[0].bytes_per_row = bytes_per_row; VideoModes[0].bytes_per_row = bytes_per_row;
VideoModes[0].depth = DepthModeForPixelDepth(); VideoModes[0].depth = DepthModeForPixelDepth(fb_depth);
VideoMonitor.mode = mode; VideoMonitor.mode = mode;
set_mac_frame_buffer(mode.depth, true); set_mac_frame_buffer(mode.depth, true);
@ -1070,14 +1069,16 @@ static bool video_open(const video_mode &mode)
XSync(x_display, false); XSync(x_display, false);
LOCK_FRAME_BUFFER; LOCK_FRAME_BUFFER;
#ifdef HAVE_PTHREADS
// Start redraw/input thread // Start redraw/input thread
#ifdef HAVE_PTHREADS
redraw_thread_cancel = false; redraw_thread_cancel = false;
redraw_thread_active = (pthread_create(&redraw_thread, NULL, redraw_func, NULL) == 0); redraw_thread_active = (pthread_create(&redraw_thread, NULL, redraw_func, NULL) == 0);
if (!redraw_thread_active) { if (!redraw_thread_active) {
printf("FATAL: cannot create redraw thread\n"); printf("FATAL: cannot create redraw thread\n");
return false; return false;
} }
#else
redraw_thread_active = true;
#endif #endif
return true; return true;
@ -1260,17 +1261,17 @@ bool VideoInit(bool classic)
// Close display // Close display
static void video_close(void) static void video_close(void)
{ {
#ifdef HAVE_PTHREADS
// Stop redraw thread // Stop redraw thread
#ifdef HAVE_PTHREADS
if (redraw_thread_active) { if (redraw_thread_active) {
redraw_thread_cancel = true; redraw_thread_cancel = true;
#ifdef HAVE_PTHREAD_CANCEL #ifdef HAVE_PTHREAD_CANCEL
pthread_cancel(redraw_thread); pthread_cancel(redraw_thread);
#endif #endif
pthread_join(redraw_thread, NULL); pthread_join(redraw_thread, NULL);
redraw_thread_active = false;
} }
#endif #endif
redraw_thread_active = false;
// Unlock frame buffer // Unlock frame buffer
UNLOCK_FRAME_BUFFER; UNLOCK_FRAME_BUFFER;
@ -2051,8 +2052,10 @@ static void VideoRefreshInit(void)
void VideoRefresh(void) void VideoRefresh(void)
{ {
// TODO: make main_unix/VideoRefresh call directly video_refresh() ? // We need to check redraw_thread_active to inhibit refreshed during
video_refresh(); // mode changes on non-threaded platforms
if (redraw_thread_active)
video_refresh();
} }
#ifdef HAVE_PTHREADS #ifdef HAVE_PTHREADS