summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2008-02-12 21:05:42 -0800
committerAaron Plattner <aplattner@nvidia.com>2008-02-12 21:05:42 -0800
commit45c9a40bee540ba6f12d42aeac444884a22d18bf (patch)
tree6db675e827922ae5f5bc9491652f2e51300f6799
parentff6454119839f5d439c1ca8eeefb5a9ed55fa579 (diff)
1.0-61111.0-6111
-rw-r--r--src/config-file.c6
-rw-r--r--src/config-file.h1
-rw-r--r--src/gtk+-2.x/ctkconfig.c36
-rw-r--r--src/gtk+-2.x/ctkwindow.c29
-rw-r--r--src/libXNVCtrl/NVCtrl.h17
-rw-r--r--src/libXNVCtrl/libXNVCtrl.abin5568 -> 5568 bytes
6 files changed, 80 insertions, 9 deletions
diff --git a/src/config-file.c b/src/config-file.c
index 7b71fe4..83a739b 100644
--- a/src/config-file.c
+++ b/src/config-file.c
@@ -618,9 +618,10 @@ ConfigPropertiesTableEntry configPropertyTable[] = {
{ "SliderTextEntries", CONFIG_PROPERTIES_SLIDER_TEXT_ENTRIES },
{ "IncludeDisplayNameInConfigFile",
CONFIG_PROPERTIES_INCLUDE_DISPLAY_NAME_IN_CONFIG_FILE },
+ { "ShowQuitDialog", CONFIG_PROPERTIES_SHOW_QUIT_DIALOG },
{ NULL, 0 }
};
-
+
/*
@@ -711,6 +712,7 @@ static void init_config_properties(ConfigProperties *conf)
conf->booleans =
(CONFIG_PROPERTIES_TOOLTIPS |
CONFIG_PROPERTIES_DISPLAY_STATUS_BAR |
- CONFIG_PROPERTIES_SLIDER_TEXT_ENTRIES);
+ CONFIG_PROPERTIES_SLIDER_TEXT_ENTRIES |
+ CONFIG_PROPERTIES_SHOW_QUIT_DIALOG);
} /* init_config_properties() */
diff --git a/src/config-file.h b/src/config-file.h
index 5227ba1..c0516d4 100644
--- a/src/config-file.h
+++ b/src/config-file.h
@@ -39,6 +39,7 @@
#define CONFIG_PROPERTIES_DISPLAY_STATUS_BAR (1<<1)
#define CONFIG_PROPERTIES_SLIDER_TEXT_ENTRIES (1<<2)
#define CONFIG_PROPERTIES_INCLUDE_DISPLAY_NAME_IN_CONFIG_FILE (1<<3)
+#define CONFIG_PROPERTIES_SHOW_QUIT_DIALOG (1<<4)
typedef struct {
unsigned int booleans;
diff --git a/src/gtk+-2.x/ctkconfig.c b/src/gtk+-2.x/ctkconfig.c
index 3be033a..b1fb6c6 100644
--- a/src/gtk+-2.x/ctkconfig.c
+++ b/src/gtk+-2.x/ctkconfig.c
@@ -65,6 +65,9 @@ static const char *__x_display_names_help =
"It is normally recommended to leave this option "
"unchecked.";
+static const char *__show_quit_dialog_help =
+"When this option is enabled, nvidia-settings will ask if you "
+"really want to quit when the quit button is pressed. ";
static void ctk_config_class_init(CtkConfigClass *ctk_config_class);
@@ -72,6 +75,7 @@ static void display_status_bar_toggled(GtkWidget *, gpointer);
static void tooltips_toggled(GtkWidget *, gpointer);
static void slider_text_entries_toggled(GtkWidget *, gpointer);
static void display_name_toggled(GtkWidget *widget, gpointer user_data);
+static void show_quit_dialog_toggled(GtkWidget *widget, gpointer user_data);
static GtkWidget *create_timer_list(CtkConfig *);
@@ -269,6 +273,25 @@ GtkWidget* ctk_config_new(ConfigProperties *conf)
G_CALLBACK(display_name_toggled), ctk_config);
ctk_config_set_tooltip(ctk_config, check_button, __x_display_names_help);
+
+ /* show quit dialog */
+
+ label = gtk_label_new("Show \"Really Quit?\" Dialog");
+
+ check_button = gtk_check_button_new();
+ gtk_container_add(GTK_CONTAINER(check_button), label);
+
+ b = !!(ctk_config->conf->booleans & CONFIG_PROPERTIES_SHOW_QUIT_DIALOG);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), b);
+
+ gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0);
+
+ g_signal_connect(G_OBJECT(check_button), "toggled",
+ G_CALLBACK(show_quit_dialog_toggled), ctk_config);
+
+ ctk_config_set_tooltip(ctk_config, check_button, __show_quit_dialog_help);
+
/* timer list */
@@ -397,6 +420,16 @@ static void display_name_toggled(GtkWidget *widget, gpointer user_data)
}
}
+static void show_quit_dialog_toggled(GtkWidget *widget, gpointer user_data)
+{
+ CtkConfig *ctk_config = CTK_CONFIG(user_data);
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ ctk_config->conf->booleans |= CONFIG_PROPERTIES_SHOW_QUIT_DIALOG;
+ } else {
+ ctk_config->conf->booleans &= ~CONFIG_PROPERTIES_SHOW_QUIT_DIALOG;
+ }
+}
gboolean ctk_config_slider_text_entry_shown(CtkConfig *ctk_config)
@@ -428,6 +461,9 @@ GtkTextBuffer *ctk_config_create_help(GtkTextTagTable *table)
ctk_help_heading(b, &i, "Include X Display Names in the Config File");
ctk_help_para(b, &i, __x_display_names_help);
+ ctk_help_heading(b, &i, "Show \"Really Quit?\" Dialog");
+ ctk_help_para(b, &i, __show_quit_dialog_help);
+
ctk_help_heading(b, &i, "Active Timers");
ctk_help_para(b, &i, "Some attributes are polled periodically "
"to ensure the reported values are up-to-date. "
diff --git a/src/gtk+-2.x/ctkwindow.c b/src/gtk+-2.x/ctkwindow.c
index 6fb84b8..3780358 100644
--- a/src/gtk+-2.x/ctkwindow.c
+++ b/src/gtk+-2.x/ctkwindow.c
@@ -79,6 +79,7 @@ static void add_page(GtkWidget *, GtkTextBuffer *, CtkWindow *,
static GtkWidget *create_quit_dialog(CtkWindow *ctk_window);
static void quit_response(GtkWidget *, gint, gpointer);
+static void save_settings_and_exit(CtkWindow *);
static void add_special_config_file_attributes(CtkWindow *ctk_window);
@@ -167,9 +168,15 @@ static void ctk_window_real_destroy(GtkObject *object)
static void close_button_clicked(GtkButton *button, gpointer user_data)
{
CtkWindow *ctk_window = CTK_WINDOW(user_data);
+ CtkConfig *ctk_config = ctk_window->ctk_config;
- gtk_widget_show_all(ctk_window->quit_dialog);
-
+ if (ctk_config->conf->booleans & CONFIG_PROPERTIES_SHOW_QUIT_DIALOG) {
+ /* ask for confirmation */
+ gtk_widget_show_all(ctk_window->quit_dialog);
+ } else {
+ /* doesn't return */
+ save_settings_and_exit(ctk_window);
+ }
} /* close_button_clicked() */
@@ -705,6 +712,17 @@ static GtkWidget *create_quit_dialog(CtkWindow *ctk_window)
} /* create_quit_dialog() */
+/*
+ * save_settings_and_exit() - save settings, perform cleanups, if
+ * necessary, and terminate nvidia-settings.
+ */
+
+static void save_settings_and_exit(CtkWindow *ctk_window)
+{
+ add_special_config_file_attributes(ctk_window);
+ gtk_main_quit();
+}
+
/*
* quit_response() - handle the response from the "really quit?"
@@ -716,11 +734,10 @@ static void quit_response(GtkWidget *button, gint response, gpointer user_data)
CtkWindow *ctk_window = CTK_WINDOW(user_data);
if (response == GTK_RESPONSE_OK) {
- add_special_config_file_attributes(ctk_window);
- gtk_main_quit();
- return;
+ /* doesn't return */
+ save_settings_and_exit(ctk_window);
}
-
+
gtk_widget_hide_all(ctk_window->quit_dialog);
} /* quit_response() */
diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h
index 2e0b64d..eb2dce4 100644
--- a/src/libXNVCtrl/NVCtrl.h
+++ b/src/libXNVCtrl/NVCtrl.h
@@ -643,10 +643,25 @@
#define NV_CTRL_AMBIENT_TEMPERATURE 64 /* R-- */
-#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_AMBIENT_TEMPERATURE
+/*
+ * NV_CTRL_PBUFFER_SCANOUT_SUPPORTED - returns whether this X screen
+ * supports scanout of FP pbuffers;
+ *
+ * if this screen does not support PBUFFER_SCANOUT, then all other
+ * PBUFFER_SCANOUT attributes are unavailable.
+ */
+#define NV_CTRL_PBUFFER_SCANOUT_SUPPORTED 65 /* R-- */
+#define NV_CTRL_PBUFFER_SCANOUT_FALSE 0
+#define NV_CTRL_PBUFFER_SCANOUT_TRUE 1
+/*
+ * NV_CTRL_PBUFFER_SCANOUT_XID indicates the XID of the pbuffer used for
+ * scanout.
+ */
+#define NV_CTRL_PBUFFER_SCANOUT_XID 66 /* RW- */
+#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_PBUFFER_SCANOUT_XID
/**************************************************************************/
diff --git a/src/libXNVCtrl/libXNVCtrl.a b/src/libXNVCtrl/libXNVCtrl.a
index 7d08a86..f1a145f 100644
--- a/src/libXNVCtrl/libXNVCtrl.a
+++ b/src/libXNVCtrl/libXNVCtrl.a
Binary files differ