decadentgray

Click to Raise in Autofocus Mode / WMFS2

Mar 7th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.96 KB | None | 0 0
  1. diff -uNr xorg62-wmfs/src/client.c xorg62-wmfs-sloppy/src/client.c
  2. --- xorg62-wmfs/src/client.c    2013-08-14 13:17:34.000000000 +0200
  3. +++ xorg62-wmfs-sloppy/src/client.c 2014-10-16 16:18:37.229643862 +0200
  4. @@ -671,6 +671,37 @@
  5.  }
  6.  
  7.  void
  8. +client_focus_diffident(struct client *c)
  9. +{
  10. +     /* Unfocus selected */
  11. +     if(W->client && W->client != c)
  12. +     {
  13. +          client_grabbuttons(W->client, false);
  14. +          client_frame_update(W->client, &W->client->ncol);
  15. +      }
  16. +
  17. +     /* Focus c */
  18. +     if((W->client = c))
  19. +     {
  20. +          c->tag->sel = c;
  21. +          client_grabbuttons(c, true);
  22. +          client_tab_focus(c);
  23. +          client_frame_update(c, CCOL(c));
  24. +
  25. +          XSetInputFocus(W->dpy, c->win, RevertToPointerRoot, CurrentTime);
  26. +          XChangeProperty(W->dpy, W->root, W->net_atom[net_active_window], XA_WINDOW, 32,
  27. +                          PropModeReplace, (unsigned char *)&c->win, 1);
  28. +     }
  29. +     else
  30. +     {
  31. +          W->client = W->screen->seltag->sel = NULL;
  32. +          XSetInputFocus(W->dpy, W->root, RevertToPointerRoot, CurrentTime);
  33. +     }
  34. +
  35. +     ewmh_update_wmfs_props();
  36. +}
  37. +
  38. +void
  39.  uicb_client_focus_click(Uicb cmd)
  40.  {
  41.       (void)cmd;
  42. diff -uNr xorg62-wmfs/src/client.h xorg62-wmfs-sloppy/src/client.h
  43. --- xorg62-wmfs/src/client.h    2013-08-14 13:17:34.000000000 +0200
  44. +++ xorg62-wmfs-sloppy/src/client.h 2014-10-16 16:07:52.637672601 +0200
  45. @@ -37,6 +37,7 @@
  46.  void _client_tab(struct client *c, struct client *cm);
  47.  void client_tab_focus(struct client *c);
  48.  void client_focus(struct client *c);
  49. +void client_focus_diffident(struct client *c);
  50.  void uicb_client_focus_click(Uicb);
  51.  void client_get_name(struct client *c);
  52.  void client_close(struct client *c);
  53. diff -uNr xorg62-wmfs/src/config.c xorg62-wmfs-sloppy/src/config.c
  54. --- xorg62-wmfs/src/config.c    2013-08-14 13:17:34.000000000 +0200
  55. +++ xorg62-wmfs-sloppy/src/config.c 2014-10-16 16:21:10.897637011 +0200
  56. @@ -254,6 +254,8 @@
  57.            W->cfocus |= CFOCUS_ENTER;
  58.       if(strstr(tmp, "click"))
  59.            W->cfocus |= CFOCUS_CLICK;
  60. +     if(strstr(tmp, "sloppy"))
  61. +          W->cfocus |= CFOCUS_SLOPPY;
  62.  
  63.       /* [mouse] */
  64.       /* for client frame AND titlebar */
  65. diff -uNr xorg62-wmfs/src/event.c xorg62-wmfs-sloppy/src/event.c
  66. --- xorg62-wmfs/src/event.c 2013-08-14 13:17:34.000000000 +0200
  67. +++ xorg62-wmfs-sloppy/src/event.c  2014-10-16 16:17:47.513646078 +0200
  68. @@ -48,6 +48,14 @@
  69.       if((c = client_gb_win(ev->window)) && c != W->client
  70.           && ev->button == 1 && W->cfocus & CFOCUS_CLICK)
  71.            client_focus(c);
  72. +     if((c = client_gb_win(ev->window))
  73. +         && ev->button == 1 && W->cfocus & CFOCUS_SLOPPY)
  74. +          if(c->flags & CLIENT_FREE
  75. +             && !(c->flags & (CLIENT_FULLSCREEN | CLIENT_TABBED)))
  76. +          {
  77. +               c->tag->flags |= CLIENT_IGNORE_ENTER;
  78. +               XRaiseWindow(W->dpy, c->frame);
  79. +          }
  80.  }
  81.  
  82.  static void
  83. @@ -80,6 +88,9 @@
  84.            else if(c != W->client && !(c->flags & CLIENT_TABBED)
  85.                    && W->cfocus & CFOCUS_ENTER)
  86.                 client_focus(c);
  87. +          else if(c != W->client && !(c->flags & CLIENT_TABBED)
  88. +                  && W->cfocus & CFOCUS_SLOPPY)
  89. +               client_focus_diffident(c);
  90.       }
  91.  }
  92.  
  93. diff -uNr xorg62-wmfs/src/wmfs.h xorg62-wmfs-sloppy/src/wmfs.h
  94. --- xorg62-wmfs/src/wmfs.h  2013-08-14 13:17:34.000000000 +0200
  95. +++ xorg62-wmfs-sloppy/src/wmfs.h   2014-10-16 15:58:47.189696919 +0200
  96. @@ -356,7 +356,8 @@
  97.       struct theme *ctheme;
  98.  #define CFOCUS_ENTER 0x01
  99.  #define CFOCUS_CLICK 0x02
  100. -     Flags cfocus; /* Focus configuration, can be set to 0, CFOCUS_ENTER or CFOCUS_CLICK*/
  101. +#define CFOCUS_SLOPPY 0x04
  102. +     Flags cfocus; /* Focus configuration, can be set to 0, CFOCUS_ENTER, CFOCUS_CLICK or CFOCUS_SLOPPY*/
  103.  
  104.       int padding;
  105.  
  106. diff -uNr xorg62-wmfs/wmfs.1 xorg62-wmfs-sloppy/wmfs.1
  107. --- xorg62-wmfs/wmfs.1  2013-08-14 13:17:34.000000000 +0200
  108. +++ xorg62-wmfs-sloppy/wmfs.1   2014-10-16 16:26:31.161622732 +0200
  109. @@ -425,7 +425,7 @@
  110.  key modifier to perform actions on clients\&.
  111.  .PP
  112.  \fB\ focus:\fR
  113. -select the focus mouse options; enter=focus follow mouse, click=click to focus, everything-else=disable focus mouse support\&.
  114. +select the focus mouse options; enter=focus follow mouse, click=click to focus, sloppy=focus follows mouse, but windows are only raised on click, everything-else=disable focus mouse support\&.
  115.  .PP
  116.  \fB\ mousebinds:\fR
  117.  mouse actions on client\&.
  118. diff -uNr xorg62-wmfs/wmfsrc xorg62-wmfs-sloppy/wmfsrc
  119. --- xorg62-wmfs/wmfsrc  2013-08-14 13:17:34.000000000 +0200
  120. +++ xorg62-wmfs-sloppy/wmfsrc   2014-10-16 16:27:18.881620604 +0200
  121. @@ -128,8 +128,9 @@
  122.    key_modifier = "Super"
  123.  
  124.    # Focus type:
  125. -  #  enter : focus follow mouse (default)
  126. -  #  click : click to focus
  127. +  #  enter  : focus follow mouse (default)
  128. +  #  click  : click to focus
  129. +  #  sloppy : focus follow mouse, but windows are raised only on click
  130.    #  everything-else : disable mouse focus support
  131.    focus = enter
Advertisement
Add Comment
Please, Sign In to add comment