"Fossies" - the Fresh Open Source Software Archive

Member "procmeter3-3.6+svn387/gtk3/window.c" (9 Jan 2012, 18898 Bytes) of package /linux/misc/procmeter3-3.6+svn387.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "window.c" see the Fossies "Dox" file reference documentation.

    1 /***************************************
    2   ProcMeter - A system monitoring program for Linux - Version 3.6.
    3 
    4   X Windows interface.
    5   ******************/ /******************
    6   Written by Andrew M. Bishop
    7 
    8   This file Copyright 1997-2012 Andrew M. Bishop
    9   It may be distributed under the GNU Public License, version 2, or
   10   any higher version.  See section COPYING of the GNU Public license
   11   for conditions under which this file may be redistributed.
   12   ***************************************/
   13 
   14 
   15 #include <stdlib.h>
   16 #include <stdio.h>
   17 #include <string.h>
   18 
   19 #include <sys/time.h>
   20 
   21 #include <gtk/gtk.h>
   22 
   23 #include "widgets/PMGeneric.h"
   24 #include "widgets/PMGraph.h"
   25 #include "widgets/PMText.h"
   26 #include "widgets/PMBar.h"
   27 
   28 #include "procmeter.h"
   29 #include "procmeterp.h"
   30 #include "window.h"
   31 
   32 
   33 #define MINHEIGHT 30
   34 #define MINWIDTH  60
   35 
   36 static gint SleepCallback(gpointer p);
   37 static void ResizePaneCallback(GtkWidget *w,GdkEventConfigure *event);
   38 static gint CloseCallback(GtkWidget *w,GdkEvent *event,gpointer data);
   39 
   40 
   41 /*+ The toplevel widget. +*/
   42 GtkWidget *toplevel;
   43 
   44 /*+ The pane that contains all of the outputs. +*/
   45 GtkWidget *pane=NULL;
   46 
   47 /*+ If the meters are aligned vertically. +*/
   48 int vertical=1;
   49 
   50 /*+ A flag that is set to true when we are told to quit. +*/
   51 extern int quit;
   52 
   53 /*+ Set to true when we are sleeping waiting for a timeout. +*/
   54 static int sleeping;
   55 
   56 /*+ A list of the outputs that are currently visible. +*/
   57 static Output *displayed=NULL;
   58 static int ndisplayed=0;
   59 
   60 /*+ A flag to indicate that we are still initialising and not to resize. +*/
   61 static int initialising=1;
   62 
   63 
   64 /*++++++++++++++++++++++++++++++++++++++
   65   Start the X-Windows & GTK part.
   66 
   67   int *argc The number of command line arguments.
   68 
   69   char **argv The actual command line arguments.
   70   ++++++++++++++++++++++++++++++++++++++*/
   71 
   72 void Start(int *argc,char **argv)
   73 {
   74  static char procmeter_version[]="ProcMeter V" PROCMETER_VERSION;
   75  char *string;
   76  int i,j=0;
   77 
   78  if((string=GetProcMeterRC("resources","horizontal")) &&
   79     StringToBoolean(string))
   80     vertical=0;
   81 
   82  /* Initialise the display */
   83 
   84  gtk_init(argc,&argv);
   85 
   86  toplevel=gtk_window_new(GTK_WINDOW_TOPLEVEL);
   87  gtk_window_set_title(GTK_WINDOW(toplevel),procmeter_version);
   88  gtk_window_set_resizable(GTK_WINDOW(toplevel),TRUE);
   89  gtk_window_set_has_resize_grip(GTK_WINDOW(toplevel),FALSE);
   90 
   91  if((string=GetProcMeterRC("resources","foreground")))
   92     gtk_widget_override_background_color(GTK_WIDGET(toplevel),GTK_STATE_FLAG_NORMAL,StringToColour(string));
   93 
   94  /* Create the menu widgets */
   95 
   96  CreateMenus(toplevel);
   97 
   98  /* Create the pane widget */
   99 
  100  if(vertical)
  101     pane=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
  102  else
  103     pane=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
  104 
  105  gtk_box_set_spacing(GTK_BOX(pane),2);
  106 
  107  gtk_container_add(GTK_CONTAINER(toplevel),pane);
  108  gtk_widget_show(GTK_WIDGET(pane));
  109 
  110  g_signal_connect(toplevel,"configure_event",G_CALLBACK(ResizePaneCallback),NULL);
  111 
  112  AddMenuToOutput(pane,NULL);
  113 
  114  /* Parse the -geometry and -w flag */
  115 
  116  for(i=1;i<*argc;i++)
  117     if((!strcmp(argv[i],"-geometry")) && (i+1<=*argc))
  118       {
  119        int x,y,w,h;
  120 
  121        i++;j+=2;
  122 
  123        if(sscanf(argv[i],"%dx%d%d%d",&w,&h,&x,&y)==4)
  124          {
  125           gtk_widget_set_size_request(GTK_WIDGET(toplevel),w,h);
  126 
  127           if(x<0) x=gdk_screen_width()-w+x;
  128           if(y<0) y=gdk_screen_height()-h+y;
  129 
  130           gtk_window_move(GTK_WINDOW(toplevel),x,y);
  131          }
  132        else if(sscanf(argv[i],"%dx%d",&w,&h)==2)
  133           gtk_widget_set_size_request(GTK_WIDGET(toplevel),w,h);
  134        else
  135           fprintf(stderr,"ProcMeter: Cannot parse -geometry option: '%s'\n",argv[i]);
  136       }
  137     else if((!strcmp(argv[i],"-w")) && (i+1<=*argc))
  138       {
  139        char *token;
  140 
  141        i++;j+=2;
  142 
  143        token=strtok(argv[i],",");
  144        while(token)
  145          {
  146           if(!strcmp(token,"above"))
  147              gtk_window_set_keep_above(GTK_WINDOW(toplevel),TRUE);
  148           else if(!strcmp(token,"below"))
  149              gtk_window_set_keep_below(GTK_WINDOW(toplevel),TRUE);
  150           else if(!strcmp(token,"skip_taskbar"))
  151              gtk_window_set_skip_taskbar_hint(GTK_WINDOW(toplevel),TRUE);
  152           else if(!strcmp(token,"skip_pager"))
  153              gtk_window_set_skip_pager_hint(GTK_WINDOW(toplevel),TRUE);
  154           else if(!strcmp(token,"sticky"))
  155              gtk_window_stick(GTK_WINDOW(toplevel));
  156           else
  157              fprintf(stderr,"ProcMeter: Cannot parse -w option: '%s'\n",token);
  158 
  159           token = strtok(NULL,",");
  160          }
  161       }
  162 
  163  if(j>0)
  164    {
  165     for(i=j;i<*argc;i++)
  166       argv[i-j]=argv[i];
  167     *argc-=j;
  168    }
  169 
  170  /* Show the widgets */
  171 
  172  gtk_widget_show(GTK_WIDGET(toplevel));
  173 
  174  /* Put an action on the window manager close button */
  175 
  176  g_signal_connect(toplevel,"delete_event",G_CALLBACK(CloseCallback),NULL);
  177 }
  178 
  179 
  180 /*++++++++++++++++++++++++++++++++++++++
  181   Stop the X-Windows & GTK part.
  182   ++++++++++++++++++++++++++++++++++++++*/
  183 
  184 void Stop(void)
  185 {
  186  DestroyMenus();
  187 
  188  gtk_main_quit();
  189 }
  190 
  191 
  192 /*++++++++++++++++++++++++++++++++++++++
  193   Sleep for the specified interval in seconds.
  194 
  195   time_t until The time to sleep until.
  196   ++++++++++++++++++++++++++++++++++++++*/
  197 
  198 void Sleep(time_t until)
  199 {
  200  struct timeval now;
  201  int delay;
  202 
  203  /* Before we sleep the first time, resize the window. */
  204 
  205  if(initialising)
  206    {
  207     Resize();
  208     initialising=0;
  209    }
  210 
  211  /* Sleep */
  212 
  213  gettimeofday(&now,NULL);
  214 
  215  delay=1000*(until-now.tv_sec)-now.tv_usec/1000;
  216 
  217  if(delay>0)
  218    {
  219     gint id=g_timeout_add(delay,SleepCallback,NULL);
  220     sleeping=1;
  221 
  222     while(sleeping)
  223       {
  224        struct timeval now2;
  225 
  226        gtk_main_iteration();
  227 
  228        gettimeofday(&now2,NULL);
  229 
  230        if(now2.tv_sec<now.tv_sec)       /* Ooops, we went back in time. Let's cancel timer */
  231          {
  232           g_source_remove(id);
  233           sleeping=0;
  234          }
  235       }
  236    }
  237 }
  238 
  239 
  240 /*++++++++++++++++++++++++++++++++++++++
  241   Add or remove an output
  242 
  243   Output output The output to be added or removed.
  244   ++++++++++++++++++++++++++++++++++++++*/
  245 
  246 void AddRemoveOutput(Output output)
  247 {
  248  if(output->output_widget)
  249    {
  250     int i,found=0;
  251 
  252     gtk_widget_destroy(GTK_WIDGET(output->output_widget));
  253 
  254     output->output_widget=NULL;
  255 
  256     for(i=0;i<ndisplayed;i++)
  257        if(displayed[i]==output)
  258           found=1;
  259        else if(found)
  260           displayed[i-1]=displayed[i];
  261     ndisplayed--;
  262    }
  263  else
  264    {
  265     GtkWidget *w=NULL;
  266     char *string,str[PROCMETER_NAME_LEN+1];
  267     Output *outputp=NULL;
  268     Module *modulep,module=NULL;
  269 
  270     for(modulep=Modules;*modulep;modulep++)
  271       {
  272        for(outputp=(*modulep)->outputs;*outputp;outputp++)
  273           if(output==*outputp)
  274             {
  275              module=*modulep;
  276              break;
  277             }
  278        if(module)
  279           break;
  280       }
  281 
  282     if(output->type==PROCMETER_GRAPH)
  283       {
  284        w=gtk_procmetergraph_new();
  285        gtk_box_pack_start(GTK_BOX(pane),w,TRUE,TRUE,0);
  286 
  287        if(vertical)
  288           gtk_widget_set_vexpand(GTK_WIDGET(w),TRUE);
  289        else
  290           gtk_widget_set_hexpand(GTK_WIDGET(w),TRUE);
  291 
  292        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"grid-foreground")) ||
  293            (string=GetProcMeterRC(module->module->name,"grid-foreground")) ||
  294            (string=GetProcMeterRC("resources","grid-foreground"))))
  295           ProcMeterGraphSetGridColour(GTK_PROCMETERGRAPH(w),StringToColour(string));
  296 
  297        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"graph-solid")) ||
  298            (string=GetProcMeterRC(module->module->name,"graph-solid")) ||
  299            (string=GetProcMeterRC("resources","graph-solid"))))
  300           ProcMeterGraphSetSolid(GTK_PROCMETERGRAPH(w),StringToBoolean(string));
  301 
  302        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"grid-max")) ||
  303            (string=GetProcMeterRC(module->module->name,"grid-max")) ||
  304            (string=GetProcMeterRC("resources","grid-max"))))
  305           ProcMeterGraphSetGridMax(GTK_PROCMETERGRAPH(w),StringToInt(string));
  306 
  307        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"grid-min")) ||
  308            (string=GetProcMeterRC(module->module->name,"grid-min")) ||
  309            (string=GetProcMeterRC("resources","grid-min"))))
  310           ProcMeterGraphSetGridMin(GTK_PROCMETERGRAPH(w),StringToInt(string));
  311  
  312        sprintf(str,output->output->graph_units,output->output->graph_scale);
  313        ProcMeterGraphSetGridUnits(GTK_PROCMETERGRAPH(w),str);
  314       }
  315     else if(output->type==PROCMETER_TEXT)
  316       {
  317        w=gtk_procmetertext_new();
  318        gtk_box_pack_start(GTK_BOX(pane),w,FALSE,TRUE,0);
  319 
  320        if(!vertical)
  321           gtk_widget_set_hexpand(GTK_WIDGET(w),TRUE);
  322 
  323        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"text-font-pango")) ||
  324            (string=GetProcMeterRC(module->module->name,"text-font-pango")) ||
  325            (string=GetProcMeterRC("resources","text-font-pango")) ||
  326            (string=GetProcMeterRC2(module->module->name,output->output->name,"text-font")) ||
  327            (string=GetProcMeterRC(module->module->name,"text-font")) ||
  328            (string=GetProcMeterRC("resources","text-font"))))
  329           ProcMeterTextSetFont(GTK_PROCMETERTEXT(w),StringToFont(string));
  330       }
  331     else if(output->type==PROCMETER_BAR)
  332       {
  333        w=gtk_procmeterbar_new();
  334        gtk_box_pack_start(GTK_BOX(pane),w,TRUE,TRUE,0);
  335 
  336        if(vertical)
  337           gtk_widget_set_vexpand(GTK_WIDGET(w),TRUE);
  338        else
  339           gtk_widget_set_hexpand(GTK_WIDGET(w),TRUE);
  340 
  341        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"grid-foreground")) ||
  342            (string=GetProcMeterRC(module->module->name,"grid-foreground")) ||
  343            (string=GetProcMeterRC("resources","grid-foreground"))))
  344           ProcMeterBarSetGridColour(GTK_PROCMETERBAR(w),StringToColour(string));
  345 
  346        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"grid-min")) ||
  347            (string=GetProcMeterRC(module->module->name,"grid-min")) ||
  348            (string=GetProcMeterRC("resources","grid-min"))))
  349           ProcMeterBarSetGridMin(GTK_PROCMETERBAR(w),StringToInt(string));
  350  
  351        if(((string=GetProcMeterRC2(module->module->name,output->output->name,"grid-max")) ||
  352            (string=GetProcMeterRC(module->module->name,"grid-max")) ||
  353            (string=GetProcMeterRC("resources","grid-max"))))
  354           ProcMeterBarSetGridMax(GTK_PROCMETERBAR(w),StringToInt(string));
  355 
  356        sprintf(str,output->output->graph_units,output->output->graph_scale);
  357        ProcMeterBarSetGridUnits(GTK_PROCMETERBAR(w),str);
  358       }
  359 
  360     /* Generic */
  361 
  362     ProcMeterGenericSetLabel(GTK_PROCMETERGENERIC(w),(gchar*)output->label);
  363 
  364     /* Resources */
  365 
  366     if(((string=GetProcMeterRC2(module->module->name,output->output->name,"foreground")) ||
  367         (string=GetProcMeterRC(module->module->name,"foreground")) ||
  368         (string=GetProcMeterRC("resources","foreground"))))
  369        ProcMeterGenericSetForegroundColour(GTK_PROCMETERGENERIC(w),StringToColour(string));
  370 
  371     if(((string=GetProcMeterRC2(module->module->name,output->output->name,"background")) ||
  372         (string=GetProcMeterRC(module->module->name,"background")) ||
  373         (string=GetProcMeterRC("resources","background"))))
  374        ProcMeterGenericSetBackgroundColour(GTK_PROCMETERGENERIC(w),StringToColour(string));
  375 
  376     if(((string=GetProcMeterRC2(module->module->name,output->output->name,"label-font-pango")) ||
  377         (string=GetProcMeterRC(module->module->name,"label-font-pango")) ||
  378         (string=GetProcMeterRC("resources","label-font-pango"))) ||
  379         (string=GetProcMeterRC2(module->module->name,output->output->name,"label-font")) ||
  380         (string=GetProcMeterRC(module->module->name,"label-font")) ||
  381         (string=GetProcMeterRC("resources","label-font")))
  382        ProcMeterGenericSetLabelFont(GTK_PROCMETERGENERIC(w),StringToFont(string));
  383 
  384     if(((string=GetProcMeterRC2(module->module->name,output->output->name,"label-foreground")) ||
  385         (string=GetProcMeterRC(module->module->name,"label-foreground")) ||
  386         (string=GetProcMeterRC("resources","label-foreground")) ||
  387         (string=GetProcMeterRC2(module->module->name,output->output->name,"foreground")) ||
  388         (string=GetProcMeterRC(module->module->name,"foreground")) ||
  389         (string=GetProcMeterRC("resources","foreground"))))
  390        ProcMeterGenericSetLabelColour(GTK_PROCMETERGENERIC(w),StringToColour(string));
  391 
  392     if(((string=GetProcMeterRC2(module->module->name,output->output->name,"label-position")) ||
  393         (string=GetProcMeterRC(module->module->name,"label-position")) ||
  394         (string=GetProcMeterRC("resources","label-position"))))
  395        ProcMeterGenericSetLabelPosition(GTK_PROCMETERGENERIC(w),StringToLabelPosition(string));
  396 
  397     AddMenuToOutput(w,module);
  398 
  399     gtk_widget_show(GTK_WIDGET(w));
  400 
  401     g_signal_handlers_block_matched(GTK_WIDGET(output->menu_item_widget),G_SIGNAL_MATCH_DATA,0,0,NULL,NULL,output);
  402     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(output->menu_item_widget),TRUE);
  403     g_signal_handlers_unblock_matched(GTK_WIDGET(output->menu_item_widget),G_SIGNAL_MATCH_DATA,0,0,NULL,NULL,output);
  404 
  405     output->output_widget=w;
  406     output->first=2;
  407 
  408     displayed=(Output*)realloc((void*)displayed,sizeof(Output)*(ndisplayed+1));
  409     displayed[ndisplayed]=output;
  410     ndisplayed++;
  411    }
  412 
  413  Resize();
  414 }
  415 
  416 
  417 /*++++++++++++++++++++++++++++++++++++++
  418   Update a graph output.
  419 
  420   Output output The output to update.
  421 
  422   short value The new value.
  423   ++++++++++++++++++++++++++++++++++++++*/
  424 
  425 void UpdateGraph(Output output,short value)
  426 {
  427  ProcMeterGraphAddDatum(output->output_widget,value);
  428 }
  429 
  430 
  431 /*++++++++++++++++++++++++++++++++++++++
  432   Update a text output.
  433 
  434   Output output The output to update.
  435 
  436   char *value The new value.
  437   ++++++++++++++++++++++++++++++++++++++*/
  438 
  439 void UpdateText(Output output,char *value)
  440 {
  441  ProcMeterTextChangeData(output->output_widget,value);
  442 }
  443 
  444 
  445 /*++++++++++++++++++++++++++++++++++++++
  446   Update a bar output.
  447 
  448   Output output The output to update.
  449 
  450   short value The new value.
  451   ++++++++++++++++++++++++++++++++++++++*/
  452 
  453 void UpdateBar(Output output,short value)
  454 {
  455  ProcMeterBarAddDatum(output->output_widget,value);
  456 }
  457 
  458 
  459 /*++++++++++++++++++++++++++++++++++++++
  460   Move an output.
  461 
  462   Output output1 The output to be moved.
  463 
  464   Output output2 The one that the output is to be moved above or below.
  465 
  466   int direction The direction to move the output (up=1 or down=2).
  467   ++++++++++++++++++++++++++++++++++++++*/
  468 
  469 void MoveOutput(Output output1,Output output2,int direction)
  470 {
  471  int i,i1=-1,i2=-1;
  472 
  473  for(i=0;i<ndisplayed;i++)
  474    {
  475     if(displayed[i]==output1)
  476        i1=i;
  477     if(displayed[i]==output2)
  478        i2=i;
  479    }
  480 
  481  if(i1==-1 || i2==-1 || i1==i2 || (direction==2 && i1==(i2+1)) || (direction==1 && i1==(i2-1)))
  482     return;
  483 
  484  gtk_box_reorder_child(GTK_BOX(pane),GTK_WIDGET(output1->output_widget),i2);
  485 
  486  Resize();
  487 
  488  if(direction==1 && i2>i1)
  489    {
  490     for(i=i1;i<i2;i++)
  491        displayed[i]=displayed[i+1];
  492     displayed[i2-1]=output1;
  493    }
  494  else if(direction==1 && i1>i2)
  495    {
  496     for(i=i1;i>i2;i--)
  497        displayed[i]=displayed[i-1];
  498     displayed[i2]=output1;
  499    }
  500  else if(direction==2 && i2>i1)
  501    {
  502     for(i=i1;i<i2;i++)
  503        displayed[i]=displayed[i+1];
  504     displayed[i2]=output1;
  505    }
  506  else /* if(direction==2 && i1>i2) */
  507    {
  508     for(i=i1;i>i2;i--)
  509        displayed[i]=displayed[i-1];
  510     displayed[i2+1]=output1;
  511    }
  512 }
  513 
  514 
  515 /*++++++++++++++++++++++++++++++++++++++
  516   Resize the pane.
  517   ++++++++++++++++++++++++++++++++++++++*/
  518 
  519 void Resize(void)
  520 {
  521  gushort psize;
  522  gint width,height;
  523  int gsize,msize;
  524  int i,ngraphs=0;
  525 
  526  if(initialising)
  527     return;
  528 
  529  if(!ndisplayed)
  530     return;
  531 
  532  height=gdk_window_get_height(gtk_widget_get_window(GTK_WIDGET(toplevel)));
  533  width=gdk_window_get_width(gtk_widget_get_window(GTK_WIDGET(toplevel)));
  534 
  535  if(vertical)
  536     psize=height;
  537  else
  538     psize=width;
  539 
  540  msize=0;
  541  gsize=psize;
  542 
  543  for(i=0;i<ndisplayed;i++)
  544    {
  545     GtkRequisition minimum,natural;
  546     int min_size=0;
  547 
  548     gtk_widget_get_preferred_size(GTK_WIDGET(displayed[i]->output_widget),&minimum,&natural);
  549 
  550     if(vertical)
  551        min_size=minimum.height;
  552     else
  553        min_size=minimum.width;
  554 
  555     if(displayed[i]->type==PROCMETER_GRAPH)
  556        ngraphs++;
  557     else if(displayed[i]->type==PROCMETER_TEXT)
  558        gsize-=min_size;
  559     else if(displayed[i]->type==PROCMETER_BAR)
  560        ngraphs++;
  561 
  562     msize+=min_size;
  563 
  564     if(i)
  565        msize+=2,gsize-=2;       /* separator between panes */
  566    }
  567 
  568  if(msize>psize || (ngraphs==0 && msize!=psize))
  569    {
  570     if(vertical)
  571        height=msize;
  572     else
  573        width=msize;
  574 
  575     gtk_widget_set_size_request(GTK_WIDGET(toplevel),0,0);
  576     gtk_window_resize(GTK_WINDOW(toplevel),width,height);
  577     gdk_window_resize(gtk_widget_get_window(GTK_WIDGET(toplevel)),width,height);
  578 
  579     gtk_widget_set_size_request(GTK_WIDGET(pane),width,height);
  580     gtk_container_resize_children(GTK_CONTAINER(pane));
  581 
  582     return;
  583    }
  584 
  585 // for(i=0;i<ndisplayed;i++)
  586 //   {
  587 //    if(displayed[i]->type==PROCMETER_GRAPH || displayed[i]->type==PROCMETER_BAR)
  588 //      {
  589 //       gushort size=gsize/ngraphs;
  590 //       gsize-=size;
  591 //       ngraphs--;
  592 //
  593 //       if(vertical)
  594 //          height=size;
  595 //       else
  596 //          width=size;
  597 //      }
  598 //    else
  599 //      {
  600 //       GtkRequisition minimum,natural;
  601 //
  602 //       gtk_widget_get_preferred_size(GTK_WIDGET(displayed[i]->output_widget),&minimum,&natural);
  603 //
  604 //       if(vertical)
  605 //          height=natural.height;
  606 //       else
  607 //          width=natural.width;
  608 //      }
  609 //
  610 //    gtk_widget_set_size_request(GTK_WIDGET(displayed[i]->output_widget),width,height);
  611 //   }
  612 
  613  gtk_widget_queue_resize(GTK_WIDGET(pane));
  614 }
  615 
  616 
  617 /*++++++++++++++++++++++++++++++++++++++
  618   The function called by the timeout to terminate the sleep.
  619 
  620   gint SleepCallback Returns true to repeat the timer.
  621 
  622   gpointer p Not used.
  623 
  624   This function is only ever called from the gtk event loop.
  625   ++++++++++++++++++++++++++++++++++++++*/
  626 
  627 static gint SleepCallback(gpointer p)
  628 {
  629  sleeping=0;
  630  return(FALSE);
  631 }
  632 
  633 
  634 /*++++++++++++++++++++++++++++++++++++++
  635   A callback that is activated by a resize event on the parent pane.
  636 
  637   GtkWidget *w The widget that caused the callback.
  638 
  639   GdkEventConfigure *event Not used.
  640 
  641   This function is only ever called from the gtk event loop.
  642   ++++++++++++++++++++++++++++++++++++++*/
  643 
  644 static void ResizePaneCallback(GtkWidget *w,GdkEventConfigure *event)
  645 {
  646  Resize();
  647 }
  648 
  649 
  650 /*++++++++++++++++++++++++++++++++++++++
  651   A callback that is activated by a close window event on the toplevel window.
  652 
  653   gint CloseCallback returns a value that indicates if the toplevel window is not to be destroyed.
  654 
  655   GtkWidget *w The widget that caused the event.
  656 
  657   GdkEvent *event The event information.
  658 
  659   gpointer data Not used.
  660 
  661   This function is only ever called from the GTK event handler.
  662   ++++++++++++++++++++++++++++++++++++++*/
  663 
  664 static gint CloseCallback(GtkWidget *w,GdkEvent *event,gpointer data)
  665 {
  666  quit=1;
  667 
  668  return(TRUE);
  669 }