sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

surf-icon-2.1.diff (5876B)


      1 diff -Nup surf-2.1/surf.c surf-icon/surf.c
      2 --- surf-2.1/surf.c	Sun May  9 19:34:33 2021
      3 +++ surf-icon/surf.c	Sat Oct  1 12:30:40 2022
      4 @@ -39,6 +39,8 @@
      5  
      6  enum { AtomFind, AtomGo, AtomUri, AtomLast };
      7  
      8 +enum { Icon16x16, Icon32x32, Icon48x48, IconLast };
      9 +
     10  enum {
     11  	OnDoc   = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT,
     12  	OnLink  = WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK,
     13 @@ -300,6 +302,7 @@ static ParamName loadfinished[] = {
     14  
     15  /* configuration, allows nested code to access above variables */
     16  #include "config.h"
     17 +#include "surf.xpm"
     18  
     19  void
     20  die(const char *errstr, ...)
     21 @@ -325,6 +328,8 @@ setup(void)
     22  {
     23  	GIOChannel *gchanin;
     24  	GdkDisplay *gdpy;
     25 +	GdkPixbuf *gpix;
     26 +	GList *icons = NULL;
     27  	int i, j;
     28  
     29  	/* clean up any zombies immediately */
     30 @@ -413,6 +418,17 @@ setup(void)
     31  			if (defconfig[j].prio >= uriparams[i].config[j].prio)
     32  				uriparams[i].config[j] = defconfig[j];
     33  		}
     34 +	}
     35 +
     36 +	/* set icons */
     37 +	for (i = 0; i < IconLast; i++) {
     38 +		gpix = gdk_pixbuf_new_from_xpm_data(surf_xpm[i]);
     39 +		icons = g_list_prepend(icons, gpix);
     40 +	}
     41 +	gtk_window_set_default_icon_list(icons);
     42 +	for (i = 0; icons != NULL && i < IconLast; i++) {
     43 +		g_object_unref(icons->data);
     44 +		icons = g_list_remove_link(icons, icons);
     45  	}
     46  }
     47  
     48 diff -Nup surf-2.1/surf.xpm surf-icon/surf.xpm
     49 --- surf-2.1/surf.xpm	Wed Dec 31 21:00:00 1969
     50 +++ surf-icon/surf.xpm	Sat Oct  1 11:44:16 2022
     51 @@ -0,0 +1,121 @@
     52 +/* XPM */
     53 +
     54 +static char * surf_16_xpm[] = {
     55 +"16 16 3 1",
     56 +" 	c None",
     57 +".	c #FFFFFF",
     58 +"+	c #0A0A0A",
     59 +"                ",
     60 +"                ",
     61 +"                ",
     62 +"            ....",
     63 +"            .+++",
     64 +"            .+++",
     65 +".............++.",
     66 +".+++++.+++++++++",
     67 +".+++++.+++++++++",
     68 +".++.++.++.++.++.",
     69 +"+++.+++++.++.++.",
     70 +"+++.+++++.++.++.",
     71 +"................",
     72 +"                ",
     73 +"                ",
     74 +"                "};
     75 +
     76 +static char * surf_32_xpm[] = {
     77 +"32 32 3 1",
     78 +" 	c None",
     79 +".	c #FFFFFF",
     80 +"+	c #000000",
     81 +"                                ",
     82 +"                                ",
     83 +"                                ",
     84 +"                                ",
     85 +"                                ",
     86 +"                                ",
     87 +"                       .........",
     88 +"                       .........",
     89 +"                       ..+++++++",
     90 +"                       ..+++++++",
     91 +"                       ..+++++++",
     92 +"                       ..+++....",
     93 +" ........................+++....",
     94 +" ........................+++....",
     95 +" ..++++++++...++++++++++++++++..",
     96 +" ..++++++++...++++++++++++++++..",
     97 +" ..++++++++...++++++++++++++++..",
     98 +" ..+++..+++...+++..+++...+++....",
     99 +"...+++..+++...+++..+++...+++....",
    100 +"...+++..+++...+++..+++...+++..  ",
    101 +"++++++..+++++++++..+++...+++..  ",
    102 +"++++++..+++++++++..+++...+++..  ",
    103 +"++++++..+++++++++..+++...+++..  ",
    104 +"..............................  ",
    105 +"..............................  ",
    106 +"                                ",
    107 +"                                ",
    108 +"                                ",
    109 +"                                ",
    110 +"                                ",
    111 +"                                ",
    112 +"                                "};
    113 +
    114 +static char * surf_48_xpm[] = {
    115 +"48 48 3 1",
    116 +" 	c None",
    117 +".	c #FFFFFF",
    118 +"+	c #000000",
    119 +"                                                ",
    120 +"                                                ",
    121 +"                                                ",
    122 +"                                                ",
    123 +"                                                ",
    124 +"                                                ",
    125 +"                                                ",
    126 +"                                                ",
    127 +"                                                ",
    128 +"                                                ",
    129 +"                                  ..............",
    130 +"                                  ..............",
    131 +"                                  ..............",
    132 +"                                  ..............",
    133 +"                                  ....++++++++..",
    134 +"                                  ....++++++++..",
    135 +"                                  ....++++++++..",
    136 +"                                  ....++++++++..",
    137 +"  ....................................++++......",
    138 +"  ....................................++++......",
    139 +"  ....................................++++......",
    140 +"  ....................................++++......",
    141 +"  ....++++++++++++....+++++++++++++++++++++++...",
    142 +"  ....++++++++++++....+++++++++++++++++++++++...",
    143 +"  ....++++++++++++....+++++++++++++++++++++++...",
    144 +"  ....++++++++++++....+++++++++++++++++++++++...",
    145 +"......++++....++++....++++....++++....++++......",
    146 +"......++++....++++....++++....++++....++++......",
    147 +"......++++....++++....++++....++++....++++......",
    148 +"......++++....++++....++++....++++....++++......",
    149 +"..++++++++....++++++++++++....++++....++++....  ",
    150 +"..++++++++....++++++++++++....++++....++++....  ",
    151 +"..++++++++....++++++++++++....++++....++++....  ",
    152 +"..++++++++....++++++++++++....++++....++++....  ",
    153 +"..............................................  ",
    154 +"..............................................  ",
    155 +"..............................................  ",
    156 +"..............................................  ",
    157 +"                                                ",
    158 +"                                                ",
    159 +"                                                ",
    160 +"                                                ",
    161 +"                                                ",
    162 +"                                                ",
    163 +"                                                ",
    164 +"                                                ",
    165 +"                                                ",
    166 +"                                                "};
    167 +
    168 +static char **surf_xpm[IconLast] = {
    169 +	[Icon16x16] = surf_16_xpm,
    170 +	[Icon32x32] = surf_32_xpm,
    171 +	[Icon48x48] = surf_48_xpm,
    172 +};