~ubuntu-branches/ubuntu/precise/nvidia-settings/precise

« back to all changes in this revision

Viewing changes to src/gtk+-2.x/ctkglx.c

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Milone
  • Date: 2011-02-25 15:18:56 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20110225151856-0lgdoygo8o4g3q47
Tags: 270.29-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include "ctkutils.h"
36
36
#include "ctkconfig.h"
37
37
#include "ctkhelp.h"
 
38
#include "ctkconstants.h"
38
39
 
39
40
#include <GL/glx.h> /* GLX #defines */
40
41
 
44
45
 
45
46
 
46
47
/* FBConfig tooltips */
 
48
static const char * __show_fbc_help =
 
49
  "Show the GLX Frame Buffer Configurations table in a new window.";
47
50
static const char * __fid_help  =
48
51
  "fid (Frame buffer ID) - Frame Buffer Configuration ID.";
49
52
static const char * __vid_help  =
167
170
}
168
171
 
169
172
 
 
173
/*
 
174
 * show_fbc_toggled() - called when the show GLX Frame Buffer Configurations
 
175
 * button has been toggled.
 
176
 */
 
177
 
 
178
static void show_fbc_toggled(GtkWidget *widget, gpointer user_data)
 
179
{
 
180
    CtkGLX *ctk_glx = user_data;
 
181
    gboolean enabled;
 
182
 
 
183
    /* get the enabled state */
 
184
 
 
185
    enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
186
 
 
187
    if (enabled) {
 
188
        gtk_widget_show_all(ctk_glx->fbc_window);
 
189
    } else {
 
190
        gtk_widget_hide(ctk_glx->fbc_window);
 
191
    }
 
192
 
 
193
    ctk_config_statusbar_message(ctk_glx->ctk_config,
 
194
                                 "Show GLX Frame Buffer Configurations button %s.",
 
195
                                 enabled ? "enabled" : "disabled");
 
196
 
 
197
} /* show_fbc_toggled() */
 
198
 
 
199
 
 
200
/*
 
201
 * fbc_window_destroy() - called when the window displaying the
 
202
 * GLX Frame Buffer Configurations table is closed.
 
203
 */
 
204
static gboolean
 
205
fbc_window_destroy(GtkWidget *widget, GdkEvent *event, gpointer user_data)
 
206
{
 
207
    CtkGLX *ctk_glx = user_data;
 
208
 
 
209
    gtk_toggle_button_set_active
 
210
        (GTK_TOGGLE_BUTTON(ctk_glx->show_fbc_button),
 
211
         FALSE);
 
212
 
 
213
    return TRUE;
 
214
 
 
215
} /* fbc_window_destroy() */
 
216
 
 
217
 
170
218
/* Creates the GLX information widget
171
219
 * 
172
220
 * NOTE: The GLX information other than the FBConfigs will
188
236
    GtkWidget *label;
189
237
    GtkWidget *banner;
190
238
    GtkWidget *hseparator;
191
 
    GtkWidget *hbox, *hbox1;
 
239
    GtkWidget *hbox;
192
240
    GtkWidget *vbox, *vbox2;
193
241
    GtkWidget *scrollWin;
194
242
    GtkWidget *event;    /* For setting the background color to white */
195
243
    GtkWidget *data_table, *header_table;
196
244
    GtkWidget *data_viewport, *full_viewport;
197
 
    GtkWidget *vscrollbar, *hscrollbar, *vpan;
 
245
    GtkWidget *vscrollbar, *hscrollbar;
 
246
    GtkWidget *show_fbc_button, *window;
198
247
    GtkRequisition req;
199
248
    ReturnStatus ret;
200
249
 
300
349
        goto fail;
301
350
    }
302
351
 
303
 
 
304
 
    /* Create clist in a scroll box */
305
 
    hbox1      = gtk_hbox_new(FALSE, 0);
306
 
    label      = gtk_label_new("Frame Buffer Configurations");
307
 
    hseparator = gtk_hseparator_new();
308
 
    gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0);
309
 
    gtk_box_pack_start(GTK_BOX(hbox1), hseparator, TRUE, TRUE, 5);
 
352
    show_fbc_button = gtk_toggle_button_new_with_label(
 
353
                          "Show GLX Frame Buffer Configurations");
 
354
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_fbc_button), FALSE);
 
355
    ctk_config_set_tooltip(ctk_config, show_fbc_button, __show_fbc_help);
 
356
    g_signal_connect(G_OBJECT(show_fbc_button),
 
357
                     "clicked", G_CALLBACK(show_fbc_toggled),
 
358
                     (gpointer) ctk_glx);
 
359
 
 
360
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 
361
    gtk_window_set_title(GTK_WINDOW(window), "GLX Frame Buffer Configurations");
 
362
    gtk_container_set_border_width(GTK_CONTAINER(window), CTK_WINDOW_PAD);
 
363
    gtk_widget_set_size_request(window, 400, 200);
 
364
    g_signal_connect(G_OBJECT(window), "destroy-event",
 
365
                     G_CALLBACK(fbc_window_destroy),
 
366
                     (gpointer) ctk_glx);
 
367
    g_signal_connect(G_OBJECT(window), "delete-event",
 
368
                     G_CALLBACK(fbc_window_destroy),
 
369
                     (gpointer) ctk_glx);
 
370
 
 
371
    ctk_glx->fbc_window = window;
 
372
    ctk_glx->show_fbc_button = show_fbc_button;
310
373
 
311
374
    hbox      = gtk_hbox_new(FALSE, 0);
312
375
    vbox      = gtk_vbox_new(FALSE, 10);
313
376
    vbox2     = gtk_vbox_new(FALSE, 10);
314
 
    vpan      = gtk_vpaned_new();
315
377
 
316
378
    data_viewport = gtk_viewport_new(NULL, NULL);
317
379
    gtk_widget_set_size_request(data_viewport, 400, 50);
377
439
    gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
378
440
    gtk_box_pack_start(GTK_BOX(hbox), vscrollbar, FALSE, FALSE, 0);
379
441
    
 
442
    gtk_container_add(GTK_CONTAINER(window), hbox);
 
443
 
380
444
    vbox = gtk_vbox_new(FALSE, 0);
381
 
    gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 5);
382
 
    gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
383
 
    
384
 
    gtk_paned_pack1 (GTK_PANED (vpan), scrollWin, TRUE, FALSE);
385
 
    gtk_paned_pack2 (GTK_PANED (vpan), vbox, TRUE, FALSE);
386
 
    gtk_box_pack_start(GTK_BOX(ctk_glx), vpan, TRUE, TRUE, 0);
 
445
    gtk_box_pack_start(GTK_BOX(vbox), show_fbc_button, FALSE, FALSE, 0);
 
446
    hbox = gtk_hbox_new(FALSE, 0);
 
447
    gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
 
448
 
 
449
    hseparator = gtk_hseparator_new();
 
450
 
 
451
    vbox = gtk_vbox_new(FALSE, 5);
 
452
    gtk_box_pack_start(GTK_BOX(vbox), scrollWin, TRUE, TRUE, 0);
 
453
    gtk_box_pack_start(GTK_BOX(vbox), hseparator, FALSE, FALSE, 0);
 
454
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
455
 
 
456
    gtk_box_pack_start(GTK_BOX(ctk_glx), vbox, TRUE, TRUE, 0);
387
457
    
388
458
    /* Fill the data table */
389
459
 
879
949
                  "by this driver."
880
950
                 );
881
951
 
 
952
    ctk_help_heading(b, &i, "Show GLX Frame Buffer Configurations");
 
953
    ctk_help_para(b, &i, __show_fbc_help);
882
954
 
883
 
    ctk_help_heading(b, &i, "Frame Buffer Configurations");
 
955
    ctk_help_heading(b, &i, "GLX Frame Buffer Configurations");
884
956
    ctk_help_para(b, &i, "This table lists the supported frame buffer "
885
957
                  "configurations for the display.");
886
958
    ctk_help_para(b, &i,