X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gtk%2Fxoptions.c;h=2c48446d96324c902ce232837a100e5225a9287e;hb=36c7e09704a7ef2229f316e8e70e423d4f0fa93b;hp=c108c1b6a67e4e5b8df9f06ff38595396ae154e8;hpb=e5876bb39d5f30d92865ff5f37b0b60f15e4fa87;p=xboard.git diff --git a/gtk/xoptions.c b/gtk/xoptions.c index c108c1b..2c48446 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -428,6 +428,14 @@ CreateMenuPopup (Option *opt, int n, int def) } else entry = gtk_menu_item_new_with_label(msg); gtk_signal_connect_object (GTK_OBJECT (entry), "activate", GTK_SIGNAL_FUNC(MenuSelect), (gpointer) (intptr_t) ((n<<16)+i)); + if(mb[i].accel) { + guint accelerator_key; + GdkModifierType accelerator_mods; + + gtk_accelerator_parse(mb[i].accel, &accelerator_key, &accelerator_mods); + gtk_widget_add_accelerator (GTK_WIDGET(entry), "activate",GtkAccelerators, + accelerator_key, accelerator_mods, GTK_ACCEL_VISIBLE); + }; gtk_widget_show(entry); } else entry = gtk_separator_menu_item_new(); gtk_menu_append(GTK_MENU (menu), entry); @@ -555,7 +563,7 @@ MemoEvent(GtkWidget *widget, GdkEvent *event, gpointer gdata) GtkTextIter start, end; String val = NULL; gboolean res; - gint index, x, y; + gint index = 0, x, y; switch(event->type) { // figure out what's up case GDK_MOTION_NOTIFY: @@ -786,7 +794,7 @@ GraphEventProc(GtkWidget *widget, GdkEvent *event, gpointer gdata) /* Get window size */ gtk_widget_get_allocation(widget, &a); w = a.width; h = a.height; -//printf("expose %dx%d @ (%d,%d)\n", w, h, a.x, a.y); +//printf("expose %dx%d @ (%d,%d): %dx%d @(%d,%d)\n", w, h, a.x, a.y, eevent->area.width, eevent->area.height, eevent->area.x, eevent->area.y); #ifdef TODO_GTK j = 0; XtSetArg(args[j], XtNwidth, &w); j++; @@ -1071,7 +1079,7 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent GtkWidget *box; GtkWidget *checkbutton; GtkWidget *entry; - GtkWidget *oldHbox, *hbox = NULL; + GtkWidget *oldHbox = NULL, *hbox = NULL; GtkWidget *pane = NULL; GtkWidget *button; GtkWidget *table; @@ -1086,10 +1094,10 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent GtkWidget *list; GtkWidget *graph; GtkWidget *menuButton; - GtkWidget *menuBar; + GtkWidget *menuBar = NULL; GtkWidget *menu; - int i, j, arraysize, left, top, height=999, width=1, boxStart, breakType = 0, r; + int i, j, arraysize, left, top, height=999, width=1, boxStart=0, breakType = 0, r; char def[MSG_SIZ], *msg, engineDlg = (currentCps != NULL && dlgNr != BrowserDlg); if(dlgNr < PromoDlg && shellUp[dlgNr]) return 0; // already up @@ -1124,16 +1132,26 @@ printf("n=%d, h=%d, w=%d\n",n,height,width); XtCreatePopupShell(title, !top || !appData.topLevel ? transientShellWidgetClass : topLevelShellWidgetClass, shells[parent], args, i); #endif - dialog = gtk_dialog_new_with_buttons( title, - GTK_WINDOW(shells[parent]), - GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR | - (modal ? GTK_DIALOG_MODAL : 0), - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - NULL ); + + if(topLevel) + { + dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); + box = gtk_vbox_new(FALSE,0); + gtk_container_add (GTK_CONTAINER (dialog), box); + } + else + { + dialog = gtk_dialog_new_with_buttons( title, + GTK_WINDOW(shells[parent]), + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR | + (modal ? GTK_DIALOG_MODAL : 0), + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, + NULL ); + box = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); + } shells[dlgNr] = dialog; - box = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); // gtk_box_set_spacing(GTK_BOX(box), 5); arraysize = 0; @@ -1481,17 +1499,19 @@ printf("n=%d, h=%d, w=%d\n",n,height,width); option[i].handle = (void *) table; // remember last table in EndMark handle (for hiding Engine-Output pane). gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_NONE); + /* Show dialog */ gtk_widget_show_all( dialog ); /* hide OK/cancel buttons */ - if((option[i].min & NO_OK)) { + if(!topLevel) + if((option[i].min & NO_OK)) { actionarea = gtk_dialog_get_action_area(GTK_DIALOG(dialog)); gtk_widget_hide(actionarea); - } else if((option[i].min & NO_CANCEL)) { + } else if((option[i].min & NO_CANCEL)) { button = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog), GTK_RESPONSE_REJECT); gtk_widget_hide(button); - } + } g_signal_connect (dialog, "response", G_CALLBACK (GenericPopDown),