URI:
       [dwm][patches][focusonclick] Updated patch for dwm 6.8 - sites - public wiki contents of suckless.org
  HTML git clone git://git.suckless.org/sites
   DIR Log
   DIR Files
   DIR Refs
       ---
   DIR commit 991946fa063cc2d7d3904834dc4d4f2d65f88dd2
   DIR parent 4ca4b788838bf083e781d92ee55eed0b1045f20e
  HTML Author: Bakkeby <bakkeby@gmail.com>
       Date:   Sat, 16 May 2026 11:39:32 +0200
       
       [dwm][patches][focusonclick] Updated patch for dwm 6.8
       
       Earlier versions of this patch missed the restack call that was
       added after 2017-01-04 and later patches, likely unintentionally,
       removes it.
       
       Keeping the restack call in there allows for windows to also
       raise on click, i.e. avoiding an additional MOD+click to raise
       floating windows.
       
       Diffstat:
         A dwm.suckless.org/patches/focusoncl… |      82 +++++++++++++++++++++++++++++++
         M dwm.suckless.org/patches/focusoncl… |       1 +
       
       2 files changed, 83 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/dwm.suckless.org/patches/focusonclick/dwm-focusonclick-20260516-44dbc68.diff b/dwm.suckless.org/patches/focusonclick/dwm-focusonclick-20260516-44dbc68.diff
       @@ -0,0 +1,82 @@
       +From 64969395a6bef3581c9d9bef6940d07f9d3ed8b7 Mon Sep 17 00:00:00 2001
       +From: Bakkeby <bakkeby@gmail.com>
       +Date: Sat, 16 May 2026 11:32:00 +0200
       +Subject: [PATCH] focusonclick - removes sloppy focus from dwm
       +
       +---
       + config.def.h |  1 +
       + dwm.c        | 13 ++++++-------
       + 2 files changed, 7 insertions(+), 7 deletions(-)
       +
       +diff --git a/config.def.h b/config.def.h
       +index 81c3fc0..a074e07 100644
       +--- a/config.def.h
       ++++ b/config.def.h
       +@@ -5,6 +5,7 @@ static const unsigned int borderpx  = 1;        /* border pixel of windows */
       + static const unsigned int snap      = 32;       /* snap pixel */
       + static const int showbar            = 1;        /* 0 means no bar */
       + static const int topbar             = 1;        /* 0 means bottom bar */
       ++static const int focusonwheel       = 0;        /* 0 allows the user to scroll window without changing focus */
       + static const char *fonts[]          = { "monospace:size=10" };
       + static const char dmenufont[]       = "monospace:size=10";
       + static const char col_gray1[]       = "#222222";
       +diff --git a/dwm.c b/dwm.c
       +index ab3a84c..e9ba431 100644
       +--- a/dwm.c
       ++++ b/dwm.c
       +@@ -162,7 +162,6 @@ static void detachstack(Client *c);
       + static Monitor *dirtomon(int dir);
       + static void drawbar(Monitor *m);
       + static void drawbars(void);
       +-static void enternotify(XEvent *e);
       + static void expose(XEvent *e);
       + static void focus(Client *c);
       + static void focusin(XEvent *e);
       +@@ -181,7 +180,6 @@ static void manage(Window w, XWindowAttributes *wa);
       + static void mappingnotify(XEvent *e);
       + static void maprequest(XEvent *e);
       + static void monocle(Monitor *m);
       +-static void motionnotify(XEvent *e);
       + static void movemouse(const Arg *arg);
       + static Client *nexttiled(Client *c);
       + static void pop(Client *c);
       +@@ -248,13 +246,11 @@ static void (*handler[LASTEvent]) (XEvent *) = {
       +         [ConfigureRequest] = configurerequest,
       +         [ConfigureNotify] = configurenotify,
       +         [DestroyNotify] = destroynotify,
       +-        [EnterNotify] = enternotify,
       +         [Expose] = expose,
       +         [FocusIn] = focusin,
       +         [KeyPress] = keypress,
       +         [MappingNotify] = mappingnotify,
       +         [MapRequest] = maprequest,
       +-        [MotionNotify] = motionnotify,
       +         [PropertyNotify] = propertynotify,
       +         [UnmapNotify] = unmapnotify
       + };
       +@@ -425,7 +421,8 @@ buttonpress(XEvent *e)
       + 
       +         click = ClkRootWin;
       +         /* focus monitor if necessary */
       +-        if ((m = wintomon(ev->window)) && m != selmon) {
       ++        if ((m = wintomon(ev->window)) && m != selmon
       ++            && (focusonwheel || (ev->button != Button4 && ev->button != Button5))) {
       +                 unfocus(selmon->sel, 1);
       +                 selmon = m;
       +                 focus(NULL);
       +@@ -445,8 +442,10 @@ buttonpress(XEvent *e)
       +                 else
       +                         click = ClkWinTitle;
       +         } else if ((c = wintoclient(ev->window))) {
       +-                focus(c);
       +-                restack(selmon);
       ++                if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) {
       ++                        focus(c);
       ++                        restack(selmon);
       ++                }
       +                 XAllowEvents(dpy, ReplayPointer, CurrentTime);
       +                 click = ClkClientWin;
       +         }
       +-- 
       +2.54.0
       +
   DIR diff --git a/dwm.suckless.org/patches/focusonclick/index.md b/dwm.suckless.org/patches/focusonclick/index.md
       @@ -7,6 +7,7 @@ Description
        
        Download
        --------
       +* [dwm-focusonclick-20260516-44dbc68.diff](dwm-focusonclick-20260516-44dbc68.diff) (2026-05-16)
        * [dwm-focusonclick-20200110-61bb8b2.diff](dwm-focusonclick-20200110-61bb8b2.diff) (2020-01-10)
        * [dwm-focusonclick-20171030-6aa8e37.diff](dwm-focusonclick-20171030-6aa8e37.diff) (2017-10-17)
        * [dwm-focusonclick-20170104-bb3bd6f.diff](dwm-focusonclick-20170104-bb3bd6f.diff) (2017-01-04)