X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gtk%2Fxoptions.c;h=d5ade4cc4d5c3f42a9f9a35952d37fc8d25611a9;hb=7d7c05d2ca68bdd6cc55fc78a1a29c6635790987;hp=01775e893317e9ef317881911bbaecead7f8079c;hpb=c5488ffd0c0e61617f06cc09444e7b7d642d00a7;p=xboard.git diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 01775e8..d5ade4c 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -566,8 +566,6 @@ MemoEvent(GtkWidget *widget, GdkEvent *event, gpointer gdata) gboolean res; gint index, x, y; - if(memo->type == Label) { ((ButtonCallback*) memo->target)(memo->value); return TRUE; } // only clock widgets use this - switch(event->type) { // figure out what's up case GDK_MOTION_NOTIFY: f = 0; @@ -583,6 +581,10 @@ MemoEvent(GtkWidget *widget, GdkEvent *event, gpointer gdata) button = bevent->button; shiftState = bevent->state & GDK_SHIFT_MASK; controlState = bevent->state & GDK_CONTROL_MASK; + if(memo->type == Label) { // only clock widgets use this + ((ButtonCallback*) memo->target)(button == 1 ? memo->value : -memo->value); + return TRUE; + } // GTK_TODO: is this really the most efficient way to get the character at the mouse cursor??? gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_WIDGET, w, h, &x, &y); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(widget), &start, x, y); @@ -1298,11 +1300,15 @@ printf("n=%d, h=%d, w=%d\n",n,height,width); label = frame; } gtk_widget_set_size_request(label, option[i].max ? option[i].max : -1, -1); - Pack(hbox, table, label, left, left+2, top, 0); if(option[i].target) { // allow user to specify event handler for button presses + button = gtk_event_box_new(); + gtk_container_add(GTK_CONTAINER(button), label); + label = button; gtk_widget_add_events(GTK_WIDGET(label), GDK_BUTTON_PRESS_MASK); g_signal_connect(label, "button-press-event", G_CALLBACK(MemoEvent), (gpointer) &option[i]); + gtk_widget_set_sensitive(label, TRUE); } + Pack(hbox, table, label, left, left+2, top, 0); break; case SaveButton: case Button: @@ -1486,9 +1492,12 @@ printf("n=%d, h=%d, w=%d\n",n,height,width); gtk_widget_show_all( dialog ); /* hide OK/cancel buttons */ - if((option[i].min & 2)) { + 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)) { + button = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog), GTK_RESPONSE_REJECT); + gtk_widget_hide(button); } g_signal_connect (dialog, "response",