commit 28ccc57aba38d071c5c7e8c68ccb1b0245da8321
parent 086e92043414d5a3b23883d4e7c9bbfcc86a47be
Author: HJ-Zhang <hjzhang216@gmail.com>
Date: Fri, 26 Jul 2024 14:14:17 +0800
preview-all-windows:format diff and set window border width
Diffstat:
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/dwm.suckless.org/patches/preview-all-win/dwm-preview-all-windows-6.5.diff b/dwm.suckless.org/patches/preview-all-win/dwm-preview-all-windows-6.5.diff
@@ -1,12 +1,12 @@
diff --git a/config.def.h b/config.def.h
-index 9efa774..2992668 100644
+index 9efa774..f462e32 100644
--- a/config.def.h
+++ b/config.def.h
@@ -95,6 +95,7 @@ static const Key keys[] = {
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
-+ { MODKEY, XK_r, previewallwin, {0} },
++ { MODKEY, XK_r, previewallwin, {0} },
};
/* button definitions */
@@ -24,7 +24,7 @@ index 8efca9a..8d7c303 100644
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/dwm.c b/dwm.c
-index 67c6b2b..bf30141 100644
+index 67c6b2b..0ddd58e 100644
--- a/dwm.c
+++ b/dwm.c
@@ -40,6 +40,8 @@
@@ -72,11 +72,12 @@ index 67c6b2b..bf30141 100644
/* variables */
static const char broken[] = "broken";
-@@ -2140,6 +2157,205 @@ zoom(const Arg *arg)
+@@ -2140,6 +2157,212 @@ zoom(const Arg *arg)
pop(c);
}
-+void previewallwin(){
++void
++previewallwin(){
+ int composite_event_base, composite_error_base;
+ if (!XCompositeQueryExtension(dpy, &composite_event_base, &composite_error_base)) {
+ fprintf(stderr, "Error: XComposite extension not available.\n");
@@ -104,6 +105,7 @@ index 67c6b2b..bf30141 100644
+ else
+ XMoveResizeWindow(dpy, c->pre.win, c->pre.x, c->pre.y, c->pre.scaled_image->width, c->pre.scaled_image->height);
+ XSetWindowBorder(dpy, c->pre.win, scheme[SchemeNorm][ColBorder].pixel);
++ XSetWindowBorderWidth(dpy, c->pre.win, borderpx);
+ XUnmapWindow(dpy, c->win);
+ if (c->pre.win){
+ XSelectInput(dpy, c->pre.win, ButtonPress | EnterWindowMask | LeaveWindowMask );
@@ -158,7 +160,8 @@ index 67c6b2b..bf30141 100644
+ focus(focus_c);
+}
+
-+void setpreviewwindowsizepositions(unsigned int n, Monitor *m, unsigned int gappo, unsigned int gappi){
++void
++setpreviewwindowsizepositions(unsigned int n, Monitor *m, unsigned int gappo, unsigned int gappi){
+ unsigned int i, j;
+ unsigned int cx, cy, cw, ch, cmaxh;
+ unsigned int cols, rows;
@@ -222,7 +225,8 @@ index 67c6b2b..bf30141 100644
+ c->pre.y += cy;
+}
+
-+XImage *getwindowximage(Client *c) {
++XImage
++*getwindowximage(Client *c) {
+ XCompositeRedirectWindow(dpy, c->win, CompositeRedirectAutomatic);
+ XWindowAttributes attr;
+ XGetWindowAttributes( dpy, c->win, &attr );
@@ -253,7 +257,8 @@ index 67c6b2b..bf30141 100644
+ return temp;
+}
+
-+XImage *scaledownimage(XImage *orig_image, unsigned int cw, unsigned int ch) {
++XImage
++*scaledownimage(XImage *orig_image, unsigned int cw, unsigned int ch) {
+ int factor_w = orig_image->width / cw + 1;
+ int factor_h = orig_image->height / ch + 1;
+ int scale_factor = factor_w > factor_h ? factor_w : factor_h;