Ejemplo n.º 1
0
/*****
 *
 * Signal handler - User clicked the 'reset hardware defaults' button.
 *
 */
static void reset_clocks_clicked(GtkWidget *widget, gpointer user_data)
{
    CtkClocks *ctk_object = CTK_CLOCKS(user_data);
    int clocks;
    ReturnStatus ret;


    /* Get the default clock frequencies */

    ret = NvCtrlGetAttribute(ctk_object->handle,
                             (ctk_object->clocks_being_modified==CLOCKS_2D) ?
                             NV_CTRL_GPU_DEFAULT_2D_CLOCK_FREQS :
                             NV_CTRL_GPU_DEFAULT_3D_CLOCK_FREQS,
                             &clocks);
    if ( ret != NvCtrlSuccess )
        goto fail;

    /* Set clock frequencies to use default values */

    ret = NvCtrlSetAttribute(ctk_object->handle,
                             (ctk_object->clocks_being_modified==CLOCKS_2D) ?
                             NV_CTRL_GPU_2D_CLOCK_FREQS :
                             NV_CTRL_GPU_3D_CLOCK_FREQS,
                             clocks);
    if ( ret != NvCtrlSuccess )
        goto fail;

    /* Set slider positions */

    set_clocks_value(ctk_object, clocks, ctk_object->clocks_being_modified);

    ctk_config_statusbar_message(ctk_object->ctk_config,
                                 "Reset %s clock frequency "
                                 "hardware defaults.",
                                 (ctk_object->clocks_being_modified==CLOCKS_2D)?
                                 "2D":"3D");

    /* Disable the apply button */

    gtk_widget_set_sensitive(ctk_object->apply_button, False);

    /* Disable the reset button */

    gtk_widget_set_sensitive(ctk_object->reset_button, False);

    return;


 fail:
    ctk_config_statusbar_message(ctk_object->ctk_config,
                                 "Failed to reset clock frequencies!");
    return;

} /* reset_clocks_clicked() */
Ejemplo n.º 2
0
static void slider_changed(GtkAdjustment *adjustment, gpointer user_data)
{
    CtkXVideo *ctk_xvideo = CTK_XVIDEO(user_data);
    gint attribute, value;
    gchar *str;
    
    user_data = g_object_get_data(G_OBJECT(adjustment), "xvideo_attribute");
    attribute = GPOINTER_TO_INT(user_data);
    value = (gint) adjustment->value;
    
    NvCtrlSetAttribute(ctk_xvideo->handle, attribute, value);

    switch (attribute) {
    case NV_CTRL_ATTR_XV_OVERLAY_SATURATION: str = "Overlay Saturation"; break;
    case NV_CTRL_ATTR_XV_OVERLAY_CONTRAST:   str = "Overlay Contrast";   break;
    case NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS: str = "Overlay Brightness"; break;
    case NV_CTRL_ATTR_XV_OVERLAY_HUE:        str = "Overlay Hue";        break;
    case NV_CTRL_ATTR_XV_TEXTURE_CONTRAST:   str = "Texture Contrast";   break;
    case NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS: str = "Texture Brightness"; break;
    case NV_CTRL_ATTR_XV_TEXTURE_HUE:        str = "Texture Hue";        break;
    case NV_CTRL_ATTR_XV_TEXTURE_SATURATION: str = "Texture Saturation"; break;

    default:
        return;
    }
    
    ctk_config_statusbar_message(ctk_xvideo->ctk_config,
                                 "Set XVideo %s to %d.", str, value);
    
} /* slider_changed() */
static void
post_dfp_scaling_update(CtkDisplayDeviceDfp *ctk_display_device_dfp,
                        gint value)
{
    int scaling_target = GET_SCALING_TARGET(value);
    int scaling_method = GET_SCALING_METHOD(value);
    
    static const char *scaling_target_string_table[] = {
        "Best Fit", /* NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT */
        "Native",   /* NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE */
    };

    static const char *scaling_method_string_table[] = {
        "Stretched",           /* NV_CTRL_GPU_SCALING_METHOD_STRETCHED */
        "Centered",            /* NV_CTRL_GPU_SCALING_METHOD_CENTERED */
        "Aspect Ratio Scaled"  /* NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED */
    };

    if ((scaling_target < NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT) ||
        (scaling_target > NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE)) return;

    if ((scaling_method < NV_CTRL_GPU_SCALING_METHOD_STRETCHED) ||
        (scaling_method > NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED)) return;
    
    ctk_config_statusbar_message(ctk_display_device_dfp->ctk_config,
                                 "Set Flat Panel Scaling for %s to %s %s.",
                                 ctk_display_device_dfp->name,
                                 scaling_method_string_table[scaling_method -1],
                                 scaling_target_string_table[scaling_target -1]);
    
} /* post_dfp_scaling_update() */
Ejemplo n.º 4
0
static void ecc_config_button_toggled(GtkWidget *widget,
                                      gpointer user_data)
{
    gboolean enabled;
    CtkEcc *ctk_ecc = CTK_ECC(user_data);
    CtrlTarget *ctrl_target = ctk_ecc->ctrl_target;
    ReturnStatus ret;

    enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

    /* show popup dialog when user first time click ECC config */
    show_ecc_toggle_warning_dlg(ctk_ecc);

    /* set the newly specified ECC value */
    ret = NvCtrlSetAttribute(ctrl_target,
                             NV_CTRL_GPU_ECC_CONFIGURATION,
                             enabled);
    if (ret != NvCtrlSuccess) {
        ctk_config_statusbar_message(ctk_ecc->ctk_config,
                                     "Failed to set ECC configuration!");
        return;
    }

    ctk_ecc->ecc_configured = enabled;

    gtk_widget_set_sensitive(ctk_ecc->reset_default_config_button, TRUE);

    /* Update status bar message */
    post_ecc_configuration_update(ctk_ecc);
} /* ecc_config_button_toggled() */
Ejemplo n.º 5
0
static void post_xv_sync_to_display_changed(CtkXVideo *ctk_xvideo,
                                            gboolean enabled,
                                            gchar *label)
{   
      ctk_config_statusbar_message(ctk_xvideo->ctk_config,
                                     "XVideo application syncing to %s.",
                                     label);
}
Ejemplo n.º 6
0
/****
 *
 * Updates widgets in relation to current overclocking state.
 *
 */
static void overclocking_state_update_gui(CtkClocks *ctk_object)
{
    ReturnStatus ret;
    int value;
    NVCTRLAttributeValidValuesRec range_detection;
    gboolean probing_optimal = TRUE;
    gboolean enabled;


    /* We need to check the overclocking state status with 
     * the server every time someone tries to change the state
     * because the set might have failed.
     */

    ret = NvCtrlGetAttribute(ctk_object->handle,
                             NV_CTRL_GPU_OVERCLOCKING_STATE,
                             &value);
    if ( ret != NvCtrlSuccess )
        enabled = False;
    else
        enabled = (value==NV_CTRL_GPU_OVERCLOCKING_STATE_MANUAL)?True:False;

    ctk_object->overclocking_enabled = enabled;


    /* We need to also make sure the server is not busy probing
     * for the optimal clocks.
     */

    if ( enabled ) {
        ret = NvCtrlGetValidAttributeValues(ctk_object->handle,
                                 NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION,
                                 &range_detection);
        if ( ret == NvCtrlSuccess ) {
            ret = NvCtrlGetAttribute(ctk_object->handle,
                                     NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE,
                                     &value);
            if ( ret == NvCtrlSuccess ) {
                probing_optimal =
                    (value == NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY);
            }
            ctk_object->probing_optimal = probing_optimal;

            ctk_object->auto_detection_available = TRUE;
        }
    }

    /* Sync the gui to be able to modify the clocks */

    sync_gui_to_modify_clocks(ctk_object, ctk_object->clocks_being_modified);

    /* Update the status bar */
    
    ctk_config_statusbar_message(ctk_object->ctk_config,
                                 "GPU overclocking %sabled.",
                                 enabled?"en":"dis");

} /* overclocking_state_update_gui() */
Ejemplo n.º 7
0
static void reset_defaults(GtkButton *button, gpointer user_data)
{
    CtkXVideo *ctk_xvideo = CTK_XVIDEO(user_data);
    
    /*
     * XXX should we expose separate buttons for each adaptor's
     * defaults?
     */
    
    NvCtrlSetAttribute(ctk_xvideo->handle,
                       NV_CTRL_ATTR_XV_OVERLAY_SET_DEFAULTS, 1);

    NvCtrlSetAttribute(ctk_xvideo->handle,
                       NV_CTRL_ATTR_XV_TEXTURE_SET_DEFAULTS, 1);
    
    NvCtrlSetAttribute(ctk_xvideo->handle,
                       NV_CTRL_ATTR_XV_BLITTER_SET_DEFAULTS, 1);
    

    reset_slider(ctk_xvideo, ctk_xvideo->overlay_saturation,
                 NV_CTRL_ATTR_XV_OVERLAY_SATURATION);
    
    reset_slider(ctk_xvideo, ctk_xvideo->overlay_contrast,
                 NV_CTRL_ATTR_XV_OVERLAY_CONTRAST);
    
    reset_slider(ctk_xvideo, ctk_xvideo->overlay_brightness,
                 NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS);
    
    reset_slider(ctk_xvideo, ctk_xvideo->overlay_hue,
                 NV_CTRL_ATTR_XV_OVERLAY_HUE);

    reset_check_button(ctk_xvideo, ctk_xvideo->texture_sync_to_blank,
                       NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK);
    
    reset_slider(ctk_xvideo, ctk_xvideo->texture_contrast,
                 NV_CTRL_ATTR_XV_TEXTURE_CONTRAST);
    
    reset_slider(ctk_xvideo, ctk_xvideo->texture_brightness,
                 NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS);

    reset_slider(ctk_xvideo, ctk_xvideo->texture_hue,
                 NV_CTRL_ATTR_XV_TEXTURE_HUE);

    reset_slider(ctk_xvideo, ctk_xvideo->texture_saturation,
                 NV_CTRL_ATTR_XV_TEXTURE_SATURATION);


    reset_check_button(ctk_xvideo, ctk_xvideo->blitter_sync_to_blank,
                       NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK);
    

    gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);

    ctk_config_statusbar_message
        (CTK_CONFIG(ctk_xvideo->ctk_config),
         "Reset XVideo hardware defaults.");
}
Ejemplo n.º 8
0
static void post_composite_termination_toggled(CtkGvoSync *ctk_gvo_sync,
                                               gboolean enabled)
{
    /* update the statusbar */
    
    ctk_config_statusbar_message(ctk_gvo_sync->ctk_config,
                                 "Composite Termination %s.",
                                 enabled ? "Enabled" : "Disabled");

} /* post_composite_termination_toggled() */
Ejemplo n.º 9
0
/*
 * Updates the status bar for when a change occured.
 */
static void post_xv_sync_to_display_update(CtkXVideo *ctk_xvideo,
                                           GtkWidget *active_button)
{
    const gchar *label;

    label = gtk_button_get_label(GTK_BUTTON(active_button));

    ctk_config_statusbar_message(ctk_xvideo->ctk_config,
                                     "XVideo application syncing to %s.",
                                     label);
}
Ejemplo n.º 10
0
static void post_scale_value_changed(GtkAdjustment *adjustment,
                                     CtkImageSliders *ctk_image_sliders,
                                     gint value)
{
    char *name = g_object_get_data(G_OBJECT(adjustment), "attribute name");

    gtk_widget_set_sensitive(ctk_image_sliders->reset_button, TRUE);

    ctk_config_statusbar_message(ctk_image_sliders->ctk_config,
                                 "%s set to %d.", name, value);

} /* post_scale_value_changed() */
static void reset_button_clicked(GtkButton *button, gpointer user_data)
{
    CtkDisplayDeviceDfp *ctk_display_device_dfp =
        CTK_DISPLAY_DEVICE_DFP(user_data);

    gint value;
    
    ctk_image_sliders_reset
        (CTK_IMAGE_SLIDERS(ctk_display_device_dfp->image_sliders));
 
    /*
     * if scaling is active, send the default scaling value to the
     * server and update the radio button group
     */
   
    if (ctk_display_device_dfp->active_attributes & __SCALING) {
        
        value =
            MAKE_SCALING_VALUE(ctk_display_device_dfp->default_scaling_target,
                               ctk_display_device_dfp->default_scaling_method);


        NvCtrlSetDisplayAttribute(ctk_display_device_dfp->handle,
                                  ctk_display_device_dfp->display_device_mask,
                                  NV_CTRL_GPU_SCALING, value);

        dfp_scaling_setup(ctk_display_device_dfp);
    }

    /* Reset the color configuration */
    if (ctk_display_device_dfp->color_controls) {
        ctk_color_controls_reset
            (CTK_COLOR_CONTROLS(ctk_display_device_dfp->color_controls));
    }

    /* Reset the dithering configuration */
    if (ctk_display_device_dfp->dithering_controls) {
        ctk_dithering_controls_reset
            (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls));
    }

    /* Update the reset button */

    gtk_widget_set_sensitive(ctk_display_device_dfp->reset_button, FALSE);

    /* status bar message */

    ctk_config_statusbar_message(ctk_display_device_dfp->ctk_config,
                                 "Reset hardware defaults for %s.",
                                 ctk_display_device_dfp->name);
    
} /* reset_button_clicked() */
Ejemplo n.º 12
0
static void post_adjustment_value_changed(GtkAdjustment *adjustment,
                                          CtkDisplayDeviceTv
                                          *ctk_display_device_tv,
                                          gint value)
{
    char *name = g_object_get_data(G_OBJECT(adjustment), "attribute name");
    
    gtk_widget_set_sensitive(ctk_display_device_tv->reset_button, TRUE);

    ctk_config_statusbar_message(ctk_display_device_tv->ctk_config,
                                 "%s set to %d.", name, value);
    
} /* post_adjustment_value_changed() */
Ejemplo n.º 13
0
static void reset_default_config_button_clicked(GtkWidget *widget,
        gpointer user_data)
{
    gboolean status;
    ReturnStatus ret;
    CtkEcc *ctk_ecc = CTK_ECC(user_data);
    CtrlTarget *ctrl_target = ctk_ecc->ctrl_target;

    /* get default status and set it to ECC configuration */
    ret = NvCtrlGetAttribute(ctrl_target,
                             NV_CTRL_GPU_ECC_DEFAULT_CONFIGURATION,
                             &status);
    if (ret != NvCtrlSuccess) {
        ctk_config_statusbar_message(ctk_ecc->ctk_config,
                                     "Failed to get default configuration!");
        return;
    }
    ret =  NvCtrlSetAttribute(ctrl_target,
                              NV_CTRL_GPU_ECC_CONFIGURATION,
                              status);
    if (ret != NvCtrlSuccess) {
        ctk_config_statusbar_message(ctk_ecc->ctk_config,
                                     "Failed to set default configuration!");
        return;
    }

    ctk_ecc->ecc_configured = status;

    /* update ECC configuration button status */
    ecc_set_config_status(ctk_ecc);

    /* show popup dialog*/
    show_ecc_toggle_warning_dlg(ctk_ecc);

    gtk_widget_set_sensitive(ctk_ecc->reset_default_config_button, FALSE);

    ctk_config_statusbar_message(ctk_ecc->ctk_config,
                                 "Set to default configuration.");
} /* reset_default_config_button_clicked() */
Ejemplo n.º 14
0
static void clear_aggregate_ecc_errors_button_clicked(GtkWidget *widget,
        gpointer user_data)
{
    CtkEcc *ctk_ecc = CTK_ECC(user_data);
    CtrlTarget *ctrl_target = ctk_ecc->ctrl_target;

    NvCtrlSetAttribute(ctrl_target,
                       NV_CTRL_GPU_ECC_RESET_ERROR_STATUS,
                       NV_CTRL_GPU_ECC_RESET_ERROR_STATUS_AGGREGATE);

    ctk_config_statusbar_message(ctk_ecc->ctk_config,
                                 "ECC aggregate errors cleared.");
} /* clear_aggregate_ecc_errors_button_clicked() */
Ejemplo n.º 15
0
static gint detect_input_done(gpointer data)
{
    CtkGvoSync *ctk_gvo_sync = CTK_GVO_SYNC(data);
    
    /* disable REACQUIRE */

    NvCtrlSetAttribute(ctk_gvo_sync->handle,
                       NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE,
                       NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE_FALSE);
    
    /* reprobe */
    
    ctk_gvo_banner_probe((gpointer)(ctk_gvo_sync->gvo_parent->banner));
    
    /* un-press the detect button */
    
    g_signal_handlers_block_by_func
        (G_OBJECT(ctk_gvo_sync->input_video_format_detect_button),
         G_CALLBACK(detect_input_toggled),
         (gpointer) ctk_gvo_sync);
    
    gtk_toggle_button_set_active
        (GTK_TOGGLE_BUTTON(ctk_gvo_sync->input_video_format_detect_button), FALSE);

    g_signal_handlers_unblock_by_func
        (G_OBJECT(ctk_gvo_sync->input_video_format_detect_button),
         G_CALLBACK(detect_input_toggled),
         (gpointer) ctk_gvo_sync);
    
    /* update the status bar */
    
    ctk_config_statusbar_message(ctk_gvo_sync->ctk_config,
                                 "Done detecting incoming signal.");
    
    /* restore sensitivity */
    
    gtk_widget_set_sensitive(ctk_gvo_sync->frame, TRUE);

    /* restore the cursor */

    gdk_window_set_cursor((GTK_WIDGET(ctk_gvo_sync->parent_window))->window,
                          NULL);

    /* ungrab the server */
    
    gtk_grab_remove(ctk_gvo_sync->input_video_format_detect_button);
    
    return FALSE;

} /* detect_input_done() */
Ejemplo n.º 16
0
/*****
 *
 * Signal handler - Called when overclocking becomes busy due to
 * an NV-CONTROL client probing for the optimal clocks.
 *
 */
static void auto_detection_state_received(GtkObject *object,
                                          gpointer arg1, gpointer user_data)
{
    CtkEventStruct *event_struct = (CtkEventStruct *) arg1;
    CtkClocks *ctk_object = CTK_CLOCKS(user_data);


    /* Update GUI with probing status */

    ctk_object->probing_optimal =
        (event_struct->value == NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY);
    sync_gui_sensitivity(ctk_object);

    /* Update the status bar */

    if ( ctk_object->probing_optimal ) {
        ctk_config_statusbar_message(ctk_object->ctk_config, "%s",
                                     __detect_wait_msg);
    } else {
        ctk_config_statusbar_message(ctk_object->ctk_config, "%s",
                                     __canceled_msg);
    }

} /* auto_detection_state_received() */
Ejemplo n.º 17
0
static void reset_sliders(CtkDisplayDeviceTv *ctk_display_device_tv)
{
    /* retrieve all existing settings */

    reset_slider(ctk_display_device_tv, ctk_display_device_tv->overscan);
    reset_slider(ctk_display_device_tv, ctk_display_device_tv->flicker_filter);
    reset_slider(ctk_display_device_tv, ctk_display_device_tv->brightness);
    reset_slider(ctk_display_device_tv, ctk_display_device_tv->hue);
    reset_slider(ctk_display_device_tv, ctk_display_device_tv->contrast);
    reset_slider(ctk_display_device_tv, ctk_display_device_tv->saturation);

    ctk_config_statusbar_message(ctk_display_device_tv->ctk_config,
                                 "Reset TV Hardware defaults for %s.",
                                 ctk_display_device_tv->name);
} /* reset_sliders() */
Ejemplo n.º 18
0
static void show_quit_dialog_toggled(GtkWidget *widget, gpointer user_data)
{
    CtkConfig *ctk_config = CTK_CONFIG(user_data);
    gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

    if (active) {
        ctk_config->conf->booleans |= CONFIG_PROPERTIES_SHOW_QUIT_DIALOG;
    } else {
        ctk_config->conf->booleans &= ~CONFIG_PROPERTIES_SHOW_QUIT_DIALOG;
    }

    ctk_config_statusbar_message(ctk_config, 
                                 "Quit confirmation dialog %s.",
                                 active ? "enabled" : "disabled");
}
Ejemplo n.º 19
0
static void tooltips_toggled(GtkWidget *widget, gpointer user_data)
{
    CtkConfig *ctk_config = CTK_CONFIG(user_data);
    gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

    if (active) {
        gtk_tooltips_enable(ctk_config->tooltips.object);
        ctk_config->conf->booleans |= CONFIG_PROPERTIES_TOOLTIPS;
    } else {
        gtk_tooltips_disable(ctk_config->tooltips.object);
        ctk_config->conf->booleans &= ~CONFIG_PROPERTIES_TOOLTIPS;
    }

    ctk_config_statusbar_message(ctk_config, "Tooltips %s.", 
                                 active ? "enabled" : "disabled");
}
Ejemplo n.º 20
0
static void slider_text_entries_toggled(GtkWidget *widget, gpointer user_data)
{
    CtkConfig *ctk_config = CTK_CONFIG(user_data);
    gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

    if (active) {
        ctk_config->conf->booleans |= CONFIG_PROPERTIES_SLIDER_TEXT_ENTRIES;
    } else {
        ctk_config->conf->booleans &= ~CONFIG_PROPERTIES_SLIDER_TEXT_ENTRIES;
    }

    ctk_config_statusbar_message(ctk_config, 
                                 "Slider text entries %s.",
                                 active ? "enabled" : "disabled");
    
    g_signal_emit(ctk_config, signals[0], 0);
}
Ejemplo n.º 21
0
static void post_ecc_configuration_update(CtkEcc *ctk_ecc)
{
    gboolean configured = ctk_ecc->ecc_configured;
    gboolean enabled = ctk_ecc->ecc_enabled;

    const char *conf_string = configured ? "enabled" : "disabled";
    char message[128];

    if (configured != enabled) {
        snprintf(message, sizeof(message), "ECC will be %s after reboot.",
                 conf_string);
    } else {
        snprintf(message, sizeof(message), "ECC %s.", conf_string);
    }

    ctk_config_statusbar_message(ctk_ecc->ctk_config, "%s", message);
} /* post_ecc_configuration_update() */
Ejemplo n.º 22
0
static void display_name_toggled(GtkWidget *widget, gpointer user_data)
{
    CtkConfig *ctk_config = CTK_CONFIG(user_data);
    gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

    if (active) {
        ctk_config->conf->booleans |=
            CONFIG_PROPERTIES_INCLUDE_DISPLAY_NAME_IN_CONFIG_FILE;
    } else {
        ctk_config->conf->booleans &=
            ~CONFIG_PROPERTIES_INCLUDE_DISPLAY_NAME_IN_CONFIG_FILE;
    }

    ctk_config_statusbar_message(ctk_config, 
                                 "Including X Display Names in Config File %s.",
                                 active ? "enabled" : "disabled");
}
Ejemplo n.º 23
0
static void timer_enable_toggled(GtkCellRendererToggle *cell,
                                 gchar                 *path_string,
                                 gpointer               user_data)
{
    CtkConfig *ctk_config = CTK_CONFIG(user_data);
    GtkTreeModel *model = GTK_TREE_MODEL(ctk_config->list_store);
    GtkTreePath *path;
    GtkTreeIter iter;
    guint handle;
    GSourceFunc function;
    gpointer data;
    TimerConfigProperty *timer_config;
    gboolean owner_enabled;
    
    path = gtk_tree_path_new_from_string(path_string);
    gtk_tree_model_get_iter(model, &iter, path);
    gtk_tree_path_free(path);

    gtk_tree_model_get(model, &iter,
                       TIMER_CONFIG_COLUMN, &timer_config,
                       OWNER_ENABLE_COLUMN, &owner_enabled,
                       HANDLE_COLUMN, &handle,
                       FUNCTION_COLUMN, &function,
                       DATA_COLUMN, &data,
                       -1);

    timer_config->user_enabled ^= 1;

    /* Start/stop the timer only when the owner widget has enabled it */

    if (owner_enabled) {
        if (timer_config->user_enabled) {
            handle = g_timeout_add(timer_config->interval, function, data);
            gtk_list_store_set(ctk_config->list_store, &iter,
                               HANDLE_COLUMN, handle, -1);
        } else {
            g_source_remove(handle);
        }
    }

    ctk_config_statusbar_message(ctk_config, "Timer \"%s\" %s.",
                                 timer_config->description,
                                 timer_config->user_enabled ? 
                                     "enabled" : "disabled");
}
Ejemplo n.º 24
0
/*****
 *
 * Callback Function - This function gets called when the GPU Overclocking
 * page gets selected from the tree view.
 *
 */
void ctk_clocks_select(GtkWidget *widget)
{
    CtkClocks *ctk_object = CTK_CLOCKS(widget);
    ReturnStatus ret;
    int value;

    /* See if we're busy probing for optimal clocks so we can tell the user */

    ret = NvCtrlGetAttribute(ctk_object->handle,
                             NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE,
                             &value);

    if ( ret == NvCtrlSuccess &&
         value == NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY ) {
        ctk_config_statusbar_message(ctk_object->ctk_config, "%s",
                                     __detect_wait_msg);
    }
}
Ejemplo n.º 25
0
static void update_rules_on_profile_name_change_toggled(GtkWidget *widget,
                                                        gpointer user_data)
{
    CtkConfig *ctk_config = CTK_CONFIG(user_data);
    gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

    if (active) {
        ctk_config->conf->booleans |=
            CONFIG_PROPERTIES_UPDATE_RULES_ON_PROFILE_NAME_CHANGE;
    } else {
        ctk_config->conf->booleans &=
            ~CONFIG_PROPERTIES_UPDATE_RULES_ON_PROFILE_NAME_CHANGE;
    }

    ctk_config_statusbar_message(ctk_config,
                                 "Updating rules when an application profile "
                                 "name changes is %s.",
                                 active ? "enabled" : "disabled");
}
Ejemplo n.º 26
0
static void post_sync_mode_menu_changed(CtkGvoSync *ctk_gvo_sync, gint value)
{
    char *name;

    /* Update the UI */

    update_input_video_format_text_entry(ctk_gvo_sync);
    update_gvo_sync_sensitivity(ctk_gvo_sync);
    
    switch (value) {
    case NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING: name = "Free Running"; break;
    case NV_CTRL_GVO_SYNC_MODE_GENLOCK:      name = "GenLock";      break;
    case NV_CTRL_GVO_SYNC_MODE_FRAMELOCK:    name = "FrameLock";    break;
    default: return;
    }

    ctk_config_statusbar_message(ctk_gvo_sync->ctk_config,
                                 "Sync Mode set to %s.", name);    

} /* post_sync_mode_menu_changed() */
Ejemplo n.º 27
0
static
void post_dithering_depth_update(CtkDitheringControls *ctk_dithering_controls,
                                 gint dithering_depth)
{
    static const char *dither_depth_table[] = {
        "Auto",  /* NV_CTRL_DITHERING_DEPTH_AUTO */
        "6 bpc", /* NV_CTRL_DITHERING_DEPTH_6_BITS */
        "8 bpc"  /* NV_CTRL_DITHERING_DEPTH_8_BITS */
    };

    if (dithering_depth < NV_CTRL_DITHERING_DEPTH_AUTO ||
        dithering_depth > NV_CTRL_DITHERING_DEPTH_8_BITS) {
        return;
    }

    gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE);
    ctk_config_statusbar_message(ctk_dithering_controls->ctk_config,
                                 "Dithering depth set to %s for %s.",
                                 dither_depth_table[dithering_depth],
                                 ctk_dithering_controls->name);
}
Ejemplo n.º 28
0
static
void post_dithering_config_update(CtkDitheringControls *ctk_dithering_controls,
                                  gint dithering_config)
{
    static const char *dither_config_table[] = {
        "Auto",    /* NV_CTRL_DITHERING_AUTO */
        "Enabled", /* NV_CTRL_DITHERING_ENABLED */
        "Disabled" /* NV_CTRL_DITHERING_DISABLED */
    };

    if (dithering_config < NV_CTRL_DITHERING_AUTO ||
        dithering_config > NV_CTRL_DITHERING_DISABLED) {
        return;
    }

    gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE);
    ctk_config_statusbar_message(ctk_dithering_controls->ctk_config,
                                 "Dithering set to %s for %s.",
                                 dither_config_table[dithering_config],
                                 ctk_dithering_controls->name);
}
Ejemplo n.º 29
0
static void reset_button_clicked(GtkButton *button, gpointer user_data)
{
    CtkDisplayDevice *ctk_object = CTK_DISPLAY_DEVICE(user_data);

    /* Disable the reset button here and allow the controls below to (re)enable
     * it if need be,.
     */
    gtk_widget_set_sensitive(ctk_object->reset_button, FALSE);

    ctk_color_controls_reset(CTK_COLOR_CONTROLS(ctk_object->color_controls));

    ctk_dithering_controls_reset
	(CTK_DITHERING_CONTROLS(ctk_object->dithering_controls));

    ctk_image_sliders_reset(CTK_IMAGE_SLIDERS(ctk_object->image_sliders));

    ctk_config_statusbar_message(ctk_object->ctk_config,
                                 "Reset hardware defaults for %s.",
                                 ctk_object->name);

} /* reset_button_clicked() */
Ejemplo n.º 30
0
static void detect_input_toggled(GtkToggleButton *togglebutton,
                                 CtkGvoSync *ctk_gvo_sync)
{
    gboolean enabled;

    enabled = gtk_toggle_button_get_active(togglebutton);

    if (!enabled) return;
        
    /* grab the server */
    
    gtk_grab_add(ctk_gvo_sync->input_video_format_detect_button);

    /* change the cursor */

    gdk_window_set_cursor
        ((GTK_WIDGET(ctk_gvo_sync->parent_window))->window,
         ctk_gvo_sync->wait_cursor);
    
    /* make all other widgets insensitive */

    gtk_widget_set_sensitive(ctk_gvo_sync->frame, FALSE);
    
    /* enable REACQUIRE */

    NvCtrlSetAttribute(ctk_gvo_sync->handle,
                       NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE,
                       NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE_TRUE);
    
    /* update the statusbar */

    ctk_config_statusbar_message(ctk_gvo_sync->ctk_config,
                                 "Detecting incoming signal...");
    
    /* register the "done" function */
    
    g_timeout_add(DEFAULT_DETECT_INPUT_TIME_INTERVAL,
                  detect_input_done, (gpointer) ctk_gvo_sync);
    
} /* detect_input_toggled() */