sites

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

surf-webkit2-keycodes-20170424-5c52733.diff (6537B)


      1 diff --git a/config.def.h b/config.def.h
      2 index dce76f8..c63f57e 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -103,58 +103,58 @@ static SiteStyle styles[] = {
      6   * edit the CLEANMASK() macro.
      7   */
      8  static Key keys[] = {
      9 -	/* modifier              keyval          function    arg */
     10 -	{ MODKEY,                GDK_KEY_g,      spawn,      SETPROP("_SURF_URI", "_SURF_GO") },
     11 -	{ MODKEY,                GDK_KEY_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     12 -	{ MODKEY,                GDK_KEY_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     13 +	/* modifier              keycode  function    arg */
     14 +	{ MODKEY,                42,      spawn,      SETPROP("_SURF_URI", "_SURF_GO") },
     15 +	{ MODKEY,                41,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     16 +	{ MODKEY,                61,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     17  
     18 -	{ 0,                     GDK_KEY_Escape, stop,       { 0 } },
     19 -	{ MODKEY,                GDK_KEY_c,      stop,       { 0 } },
     20 +	{ 0,                     9,       stop,       { 0 } },
     21 +	{ MODKEY,                54,      stop,       { 0 } },
     22  
     23 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r,      reload,     { .b = 1 } },
     24 -	{ MODKEY,                GDK_KEY_r,      reload,     { .b = 0 } },
     25 +	{ MODKEY|GDK_SHIFT_MASK, 27,      reload,     { .b = 1 } },
     26 +	{ MODKEY,                27,      reload,     { .b = 0 } },
     27  
     28 -	{ MODKEY,                GDK_KEY_l,      navigate,   { .i = +1 } },
     29 -	{ MODKEY,                GDK_KEY_h,      navigate,   { .i = -1 } },
     30 +	{ MODKEY,                46,      navigate,   { .i = +1 } },
     31 +	{ MODKEY,                43,      navigate,   { .i = -1 } },
     32  
     33  	/* Currently we have to use scrolling steps that WebKit2GTK+ gives us
     34  	 * d: step down, u: step up, r: step right, l:step left
     35  	 * D: page down, U: page up */
     36 -	{ MODKEY,                GDK_KEY_j,      scroll,     { .i = 'd' } },
     37 -	{ MODKEY,                GDK_KEY_k,      scroll,     { .i = 'u' } },
     38 -	{ MODKEY,                GDK_KEY_b,      scroll,     { .i = 'U' } },
     39 -	{ MODKEY,                GDK_KEY_space,  scroll,     { .i = 'D' } },
     40 -	{ MODKEY,                GDK_KEY_i,      scroll,     { .i = 'r' } },
     41 -	{ MODKEY,                GDK_KEY_u,      scroll,     { .i = 'l' } },
     42 -
     43 -
     44 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_j,      zoom,       { .i = -1 } },
     45 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_k,      zoom,       { .i = +1 } },
     46 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_q,      zoom,       { .i = 0  } },
     47 -	{ MODKEY,                GDK_KEY_minus,  zoom,       { .i = -1 } },
     48 -	{ MODKEY,                GDK_KEY_plus,   zoom,       { .i = +1 } },
     49 -
     50 -	{ MODKEY,                GDK_KEY_p,      clipboard,  { .b = 1 } },
     51 -	{ MODKEY,                GDK_KEY_y,      clipboard,  { .b = 0 } },
     52 -
     53 -	{ MODKEY,                GDK_KEY_n,      find,       { .i = +1 } },
     54 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_n,      find,       { .i = -1 } },
     55 -
     56 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_p,      print,      { 0 } },
     57 -
     58 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a,      togglecookiepolicy, { 0 } },
     59 -	{ 0,                     GDK_KEY_F11,    togglefullscreen, { 0 } },
     60 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o,      toggleinspector, { 0 } },
     61 -
     62 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_c,      toggle,     { .i = CaretBrowsing } },
     63 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_f,      toggle,     { .i = FrameFlattening } },
     64 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_g,      toggle,     { .i = Geolocation } },
     65 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_s,      toggle,     { .i = JavaScript } },
     66 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i,      toggle,     { .i = LoadImages } },
     67 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_v,      toggle,     { .i = Plugins } },
     68 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b,      toggle,     { .i = ScrollBars } },
     69 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t,      toggle,     { .i = StrictTLS } },
     70 -	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m,      toggle,     { .i = Style } },
     71 +	{ MODKEY,                44,      scroll,     { .i = 'd' } },
     72 +	{ MODKEY,                45,      scroll,     { .i = 'u' } },
     73 +	{ MODKEY,                56,      scroll,     { .i = 'U' } },
     74 +	{ MODKEY,                65,      scroll,     { .i = 'D' } },
     75 +	{ MODKEY,                31,      scroll,     { .i = 'r' } },
     76 +	{ MODKEY,                30,      scroll,     { .i = 'l' } },
     77 +
     78 +
     79 +	{ MODKEY|GDK_SHIFT_MASK, 44,      zoom,       { .i = -1 } },
     80 +	{ MODKEY|GDK_SHIFT_MASK, 45,      zoom,       { .i = +1 } },
     81 +	{ MODKEY|GDK_SHIFT_MASK, 24,      zoom,       { .i = 0  } },
     82 +	{ MODKEY,                20,      zoom,       { .i = -1 } },
     83 +	{ MODKEY,                21,      zoom,       { .i = +1 } },
     84 +
     85 +	{ MODKEY,                33,      clipboard,  { .b = 1 } },
     86 +	{ MODKEY,                29,      clipboard,  { .b = 0 } },
     87 +
     88 +	{ MODKEY,                57,      find,       { .i = +1 } },
     89 +	{ MODKEY|GDK_SHIFT_MASK, 57,      find,       { .i = -1 } },
     90 +
     91 +	{ MODKEY|GDK_SHIFT_MASK, 33,      print,      { 0 } },
     92 +
     93 +	{ MODKEY|GDK_SHIFT_MASK, 38,      togglecookiepolicy, { 0 } },
     94 +	{ 0,                     95,      togglefullscreen, { 0 } },
     95 +	{ MODKEY|GDK_SHIFT_MASK, 32,      toggleinspector, { 0 } },
     96 +
     97 +	{ MODKEY|GDK_SHIFT_MASK, 54,      toggle,     { .i = CaretBrowsing } },
     98 +	{ MODKEY|GDK_SHIFT_MASK, 41,      toggle,     { .i = FrameFlattening } },
     99 +	{ MODKEY|GDK_SHIFT_MASK, 42,      toggle,     { .i = Geolocation } },
    100 +	{ MODKEY|GDK_SHIFT_MASK, 39,      toggle,     { .i = JavaScript } },
    101 +	{ MODKEY|GDK_SHIFT_MASK, 31,      toggle,     { .i = LoadImages } },
    102 +	{ MODKEY|GDK_SHIFT_MASK, 55,      toggle,     { .i = Plugins } },
    103 +	{ MODKEY|GDK_SHIFT_MASK, 56,      toggle,     { .i = ScrollBars } },
    104 +	{ MODKEY|GDK_SHIFT_MASK, 28,      toggle,     { .i = StrictTLS } },
    105 +	{ MODKEY|GDK_SHIFT_MASK, 58,      toggle,     { .i = Style } },
    106  };
    107  
    108  /* button definitions */
    109 diff --git a/surf.c b/surf.c
    110 index 9f0c8a1..07a362c 100644
    111 --- a/surf.c
    112 +++ b/surf.c
    113 @@ -114,7 +114,7 @@ typedef struct Client {
    114  
    115  typedef struct {
    116  	guint mod;
    117 -	guint keyval;
    118 +	guint16 keycode;
    119  	void (*func)(Client *c, const Arg *a);
    120  	const Arg arg;
    121  } Key;
    122 @@ -1118,10 +1118,9 @@ winevent(GtkWidget *w, GdkEvent *e, Client *c)
    123  	case GDK_KEY_PRESS:
    124  		if (!curconfig[KioskMode].val.b) {
    125  			for (i = 0; i < LENGTH(keys); ++i) {
    126 -				if (gdk_keyval_to_lower(e->key.keyval) ==
    127 -				    keys[i].keyval &&
    128 -				    CLEANMASK(e->key.state) == keys[i].mod &&
    129 -				    keys[i].func) {
    130 +				if (e->key.hardware_keycode == keys[i].keycode
    131 +				    && CLEANMASK(e->key.state) == keys[i].mod
    132 +				    && keys[i].func) {
    133  					updatewinid(c);
    134  					keys[i].func(c, &(keys[i].arg));
    135  					return TRUE;