- screen prefs "dga" changed to "dga/<width>/<height>", with zero width/height

meaning "maximum" (also for window mode)
- Caps Lock now behaves as expected
This commit is contained in:
cebix 1999-10-03 19:43:28 +00:00
parent 65244bc22c
commit 9a68908882
2 changed files with 59 additions and 25 deletions

View File

@ -526,13 +526,9 @@ static void hide_show_graphics_widgets(void)
switch (display_type) {
case DISPLAY_WINDOW:
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip);
gtk_widget_show(w_display_x); gtk_widget_show(l_display_x);
gtk_widget_show(w_display_y); gtk_widget_show(l_display_y);
break;
case DISPLAY_SCREEN:
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip);
gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x);
gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y);
break;
}
}
@ -576,7 +572,7 @@ static void parse_graphics_prefs(void)
if (str) {
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2)
display_type = DISPLAY_WINDOW;
else if (strcmp(str, "dga") == 0)
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2)
display_type = DISPLAY_SCREEN;
}
}
@ -598,7 +594,7 @@ static void read_graphics_settings(void)
sprintf(pref, "win/%d/%d", dis_width, dis_height);
break;
case DISPLAY_SCREEN:
strcpy(pref, "dga");
sprintf(pref, "dga/%d/%d", dis_width, dis_height);
break;
default:
PrefsRemoveItem("screen");
@ -610,7 +606,7 @@ static void read_graphics_settings(void)
// Create "Graphics/Sound" pane
static void create_graphics_pane(GtkWidget *top)
{
GtkWidget *box, *table, *label, *opt, *menu;
GtkWidget *box, *table, *label, *opt, *menu, *combo;
char str[32];
parse_graphics_prefs();
@ -679,21 +675,43 @@ static void create_graphics_pane(GtkWidget *top)
gtk_widget_show(l_display_x);
gtk_table_attach(GTK_TABLE(table), l_display_x, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
w_display_x = gtk_entry_new();
gtk_widget_show(w_display_x);
combo = gtk_combo_new();
gtk_widget_show(combo);
GList *glist1 = NULL;
glist1 = g_list_append(glist1, (char *)"512");
glist1 = g_list_append(glist1, (char *)"640");
glist1 = g_list_append(glist1, (char *)"800");
glist1 = g_list_append(glist1, (char *)"1024");
glist1 = g_list_append(glist1, (char *)"MAX");
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist1);
if (dis_width)
sprintf(str, "%d", dis_width);
gtk_entry_set_text(GTK_ENTRY(w_display_x), str);
gtk_table_attach(GTK_TABLE(table), w_display_x, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
else
strcpy(str, "MAX");
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
w_display_x = GTK_COMBO(combo)->entry;
l_display_y = gtk_label_new(GetString(STR_DISPLAY_Y_CTRL));
gtk_widget_show(l_display_y);
gtk_table_attach(GTK_TABLE(table), l_display_y, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
w_display_y = gtk_entry_new();
gtk_widget_show(w_display_y);
combo = gtk_combo_new();
gtk_widget_show(combo);
GList *glist2 = NULL;
glist2 = g_list_append(glist2, (char *)"384");
glist2 = g_list_append(glist2, (char *)"480");
glist2 = g_list_append(glist2, (char *)"600");
glist2 = g_list_append(glist2, (char *)"768");
glist2 = g_list_append(glist2, (char *)"MAX");
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist2);
if (dis_height)
sprintf(str, "%d", dis_height);
gtk_entry_set_text(GTK_ENTRY(w_display_y), str);
gtk_table_attach(GTK_TABLE(table), w_display_y, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
else
strcpy(str, "MAX");
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
w_display_y = GTK_COMBO(combo)->entry;
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
@ -759,7 +777,7 @@ static GList *add_serial_names(void)
if (glist)
g_list_sort(glist, gl_str_cmp);
else
glist = g_list_append(glist, "<none>");
glist = g_list_append(glist, (char *)"<none>");
return glist;
}
@ -795,7 +813,7 @@ static GList *add_ether_names(void)
if (glist)
g_list_sort(glist, gl_str_cmp);
else
glist = g_list_append(glist, "<none>");
glist = g_list_append(glist, (char *)"<none>");
return glist;
}

View File

@ -61,7 +61,7 @@ enum {
// Constants
const char KEYCODE_FILE_NAME[] = SHAREDIR "keycodes";
const char KEYCODE_FILE_NAME[] = SHAREDIR "/keycodes";
// Global variables
@ -75,6 +75,7 @@ static pthread_t redraw_thread; // Redraw thread
static bool has_dga = false; // Flag: Video DGA capable
static bool ctrl_down = false; // Flag: Ctrl key pressed
static bool caps_on = false; // Flag: Caps Lock on
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
static bool emul_suspended = false; // Flag: Emulator suspended
@ -539,11 +540,17 @@ bool VideoInit(bool classic)
if (mode_str) {
if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2)
display_type = DISPLAY_WINDOW;
else if (has_dga && strcmp(mode_str, "dga") == 0) {
else if (has_dga && sscanf(mode_str, "dga/%d/%d", &width, &height) == 2) {
display_type = DISPLAY_DGA;
if (width > DisplayWidth(x_display, screen))
width = DisplayWidth(x_display, screen);
if (height > DisplayHeight(x_display, screen))
height = DisplayHeight(x_display, screen);
}
if (width <= 0)
width = DisplayWidth(x_display, screen);
if (height <= 0)
height = DisplayHeight(x_display, screen);
}
// Initialize according to display type
@ -968,6 +975,15 @@ static void handle_events(void)
code = event2keycode((XKeyEvent *)&event);
if (code != -1) {
if (!emul_suspended) {
if (code == 0x39) { // Caps Lock pressed
if (caps_on) {
ADBKeyUp(code);
caps_on = false;
} else {
ADBKeyDown(code);
caps_on = true;
}
} else
ADBKeyDown(code);
if (code == 0x36)
ctrl_down = true;
@ -987,7 +1003,7 @@ static void handle_events(void)
code = keycode_table[((XKeyEvent *)&event)->keycode & 0xff];
} else
code = event2keycode((XKeyEvent *)&event);
if (code != -1) {
if (code != -1 && code != 0x39) { // Don't propagate Caps Lock releases
ADBKeyUp(code);
if (code == 0x36)
ctrl_down = false;