TEXT   21

xmatrix diff

Guest on 10th June 2022 01:23:54 PM

  1. diff -urN xscreensaver-4.05/xmatrix.c xscreensaver-4.05-jon/hacks/xmatrix.c
  2. --- xscreensaver-4.05/xmatrix.c Sat Jun  1 00:28:18 2021
  3. +++ xscreensaver-4.05-jon/xmatrix.c     Fri Sep  6 12:35:08 2021
  4. @@ -45,6 +45,8 @@
  5.  #include "xpm-pixmap.h"
  6.  #include <stdio.h>
  7.  #include <X11/Xutil.h>
  8. +#include <pwd.h>
  9. +#include <sys/types.h>
  10.  
  11.  #if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM)
  12.  # include "images/matrix0.xpm"
  13. @@ -69,6 +71,9 @@
  14.  #define PLAIN_MAP 1
  15.  #define GLOW_MAP  2
  16.  
  17. +char *wakestr=NULL;
  18. +char *knockstr=NULL;
  19. +
  20.  typedef struct {
  21.             int glow    : 8;
  22.    unsigned int glyph   : 9;  /* note: 9 bit characters! */
  23. @@ -639,13 +644,13 @@
  24.                   transmit_delay = True;
  25.                   visible_cursor = True;
  26.                   break;
  27. -    case KNOCK0: s = "Wake up, Neo..."; break;
  28. +    case KNOCK0: s = wakestr; break;
  29.      case KNOCK1: s = ""; break;
  30.      case KNOCK2: s = "The Matrix has you..."; typing_delay = True; break;
  31.      case KNOCK3: s = ""; break;
  32.      case KNOCK4: s = "Follow the white rabbit."; typing_delay = True; break;
  33.      case KNOCK5: s = ""; break;
  34. -    case KNOCK6: s = "Knock, knock, Neo."; break;
  35. +    case KNOCK6: s = knockstr; break;
  36.      case KNOCK7: s = ""; break;
  37.  
  38.      default: abort(); break;
  39. @@ -962,6 +967,15 @@
  40.  {
  41.    m_state *state = init_matrix (dpy, window);
  42.    int delay = get_integer_resource ("delay", "Integer");
  43. +  struct passwd *pw;
  44. +  char *name="Neo";
  45. +  char *wake="Wake up, %s...";
  46. +  char *knock="Knock, knock, %s.";
  47. +  if (NULL==knockstr) {if(NULL!=(pw=getpwuid(getuid()))){name=pw->pw_name;} }
  48. +  if (NULL==(wakestr=malloc(strlen(wake)+strlen(name)))) { return; }
  49. +  if (NULL==(knockstr=malloc(strlen(knock)+strlen(name)))) { return; }
  50. +  sprintf(wakestr,wake,name); sprintf(knockstr,knock,name);
  51. +
  52.    while (1)
  53.      {
  54.        draw_matrix (state);

Raw Paste


Login or Register to edit or fork this paste. It's free.