From ad1ec15df7dbe0e0c342223b68cea9775aab9c62 Mon Sep 17 00:00:00 2001 From: Ray Andrew <4437323+rayandrew@users.noreply.github.com> Date: Sat, 28 Sep 2024 00:39:09 -0500 Subject: [PATCH] remove bar --- Makefile | 2 +- config.def.h | 69 +++---- drwl.h | 311 ----------------------------- dwl.c | 555 ++++++++------------------------------------------- 4 files changed, 110 insertions(+), 827 deletions(-) delete mode 100644 drwl.h diff --git a/Makefile b/Makefile index 46258d7..f62af4e 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement \ -Wfloat-conversion # CFLAGS / LDFLAGS -PKGS = wlroots-0.18 wayland-server xkbcommon libinput pixman-1 fcft $(XLIBS) +PKGS = wlroots-0.18 wayland-server xkbcommon libinput $(XLIBS) DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS) LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS) diff --git a/config.def.h b/config.def.h index 1613c42..afcce1f 100644 --- a/config.def.h +++ b/config.def.h @@ -9,48 +9,47 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ static const int monoclegaps = 1; /* 1 means outer gaps in monocle layout */ static const unsigned int borderpx = 1; /* border pixel of windows */ -static const int user_bh = 0; /* 0 means that dwl will calculate barheight, >= 1 means dwl will use user_bh as the bar height. */ static const unsigned int gappih = 10; /* horiz inner gap between windows */ static const unsigned int gappiv = 10; /* vert inner gap between windows */ static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */ -// static const float rootcolor[] = COLOR(0x1e222aff); -// static const float bordercolor[] = COLOR(0x282b2cff); -// static const float focuscolor[] = COLOR(0xd1b171ff); -// static const float urgentcolor[] = COLOR(0xec6b64ff); +static const float rootcolor[] = COLOR(0x1e222aff); +static const float bordercolor[] = COLOR(0x282b2cff); +static const float focuscolor[] = COLOR(0xd1b171ff); +static const float urgentcolor[] = COLOR(0xec6b64ff); static const int showbar = 0; /* 0 means no bar */ static const int topbar = 0; /* 0 means bottom bar */ // static const char *fonts[] = {"monospace:size=10"}; // static const char *fonts[] = { "JetBrainsMono Nerd Font Mono:style:medium:size=14", "Font Awesome 6 Free Regular:size=14", "Iosevka:style:medium:size=14", "monospace:size=14" }; static const char *fonts[] = { "JetBrainsMonoNL Nerd Font:size=20:antialias=true:autohint=true" - // "DejaVu Sans Mono for Powerline:style=Book:size=16", - // "JoyPixels:size=16:antialias=true:autohint=true", - // "Font Awesome 6 Free,Font Awesome 6 Free Regular:style=Regular:size=16:antialias=true:autohint=true" + "DejaVu Sans Mono for Powerline:style=Book:size=16", + "JoyPixels:size=16:antialias=true:autohint=true", + "Font Awesome 6 Free,Font Awesome 6 Free Regular:style=Regular:size=16:antialias=true:autohint=true" }; // static const char *fonts[] = { "JetBrainsMono Nerd Font Mono:style:medium:size=14", "Iosevka:style:medium:size=14", "monospace:size=14" }; /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */ // static const float rootcolor[] = COLOR(0x000000ff); -static const uint32_t black = 0x1e222aff; -static const uint32_t white = 0xc7b89dff; -static const uint32_t gray2 = 0x282b2cff; // unfocused window border -static const uint32_t gray3 = 0x5d6061ff; -static const uint32_t gray4 = 0x282b2cff; -static const uint32_t blue = 0x6f8fafff; // focused window border -static const uint32_t green = 0x89b482ff; -static const uint32_t red = 0xec6b64ff; -static const uint32_t orange = 0xd6b676ff; -static const uint32_t yellow = 0xd1b171ff; -static const uint32_t pink = 0xcc7f94ff; -static const uint32_t col_borderbar = 0x1e2122ff; -static const float rootcolor[] = COLOR(black); -static uint32_t colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { white, black, gray2 }, - [SchemeSel] = { blue, black, yellow }, - [SchemeUrg] = { 0, 0, 0xec6b64ff }, -}; +// static const uint32_t black = 0x1e222aff; +// static const uint32_t white = 0xc7b89dff; +// static const uint32_t gray2 = 0x282b2cff; // unfocused window border +// static const uint32_t gray3 = 0x5d6061ff; +// static const uint32_t gray4 = 0x282b2cff; +// static const uint32_t blue = 0x6f8fafff; // focused window border +// static const uint32_t green = 0x89b482ff; +// static const uint32_t red = 0xec6b64ff; +// static const uint32_t orange = 0xd6b676ff; +// static const uint32_t yellow = 0xd1b171ff; +// static const uint32_t pink = 0xcc7f94ff; +// static const uint32_t col_borderbar = 0x1e2122ff; +// static const float rootcolor[] = COLOR(black); +// static uint32_t colors[][3] = { +// /* fg bg border */ +// [SchemeNorm] = { white, black, gray2 }, +// [SchemeSel] = { blue, black, yellow }, +// [SchemeUrg] = { 0, 0, 0xec6b64ff }, +// }; static const unsigned int swipe_min_threshold = 0; @@ -224,7 +223,7 @@ static const Key keys[] = { { MODKEY, XKB_KEY_Return, spawn, {.v = termcmd} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_B, togglebar, {0} }, + // { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_B, togglebar, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J, focusstack, {.i = +1} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_h, focusdir, {.ui = 0} }, @@ -317,17 +316,9 @@ static const Key keys[] = { }; static const Button buttons[] = { - { ClkLtSymbol, 0, BTN_LEFT, setlayout, {.v = &layouts[0]} }, - { ClkLtSymbol, 0, BTN_RIGHT, setlayout, {.v = &layouts[2]} }, - { ClkTitle, 0, BTN_MIDDLE, zoom, {0} }, - { ClkStatus, 0, BTN_MIDDLE, spawn, {.v = termcmd} }, - { ClkClient, MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} }, - { ClkClient, MODKEY, BTN_MIDDLE, togglefloating, {0} }, - { ClkClient, MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} }, - { ClkTagBar, 0, BTN_LEFT, view, {0} }, - { ClkTagBar, 0, BTN_RIGHT, toggleview, {0} }, - { ClkTagBar, MODKEY, BTN_LEFT, tag, {0} }, - { ClkTagBar, MODKEY, BTN_RIGHT, toggletag, {0} }, + { MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} }, + { MODKEY, BTN_MIDDLE, togglefloating, {0} }, + { MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} }, }; static const Gesture gestures[] = { diff --git a/drwl.h b/drwl.h deleted file mode 100644 index b06a736..0000000 --- a/drwl.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - * drwl - https://codeberg.org/sewn/drwl - * - * Copyright (c) 2023-2024 sewn - * Copyright (c) 2024 notchoc - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The UTF-8 Decoder included is from Bjoern Hoehrmann: - * Copyright (c) 2008-2010 Bjoern Hoehrmann - * See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. - */ -#pragma once - -#include -#include -#include - -enum { ColFg, ColBg, ColBorder }; /* colorscheme index */ - -typedef struct fcft_font Fnt; -typedef pixman_image_t Img; - -typedef struct { - Img *image; - Fnt *font; - uint32_t *scheme; -} Drwl; - -#define UTF8_ACCEPT 0 -#define UTF8_REJECT 12 -#define UTF8_INVALID 0xFFFD - -static const uint8_t utf8d[] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, - 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, - - 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12, - 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12, - 12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12, - 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12, - 12,36,12,12,12,12,12,12,12,12,12,12, -}; - -static inline uint32_t -utf8decode(uint32_t *state, uint32_t *codep, uint8_t byte) -{ - uint32_t type = utf8d[byte]; - - *codep = (*state != UTF8_ACCEPT) ? - (byte & 0x3fu) | (*codep << 6) : - (0xff >> type) & (byte); - - *state = utf8d[256 + *state + type]; - return *state; -} - -static int -drwl_init(void) -{ - fcft_set_scaling_filter(FCFT_SCALING_FILTER_LANCZOS3); - return fcft_init(FCFT_LOG_COLORIZE_AUTO, 0, FCFT_LOG_CLASS_ERROR); -} - -static Drwl * -drwl_create(void) -{ - Drwl *drwl; - - if (!(drwl = calloc(1, sizeof(Drwl)))) - return NULL; - - return drwl; -} - -static void -drwl_setfont(Drwl *drwl, Fnt *font) -{ - if (drwl) - drwl->font = font; -} - -static void -drwl_setimage(Drwl *drwl, Img *image) -{ - if (drwl) - drwl->image = image; -} - -static Fnt * -drwl_font_create(Drwl *drwl, size_t count, - const char *names[static count], const char *attributes) -{ - Fnt *font = fcft_from_name(count, names, attributes); - if (drwl) - drwl_setfont(drwl, font); - return font; -} - -static void -drwl_font_destroy(Fnt *font) -{ - fcft_destroy(font); -} - -static inline pixman_color_t -convert_color(uint32_t clr) -{ - return (pixman_color_t){ - ((clr >> 24) & 0xFF) * 0x101 * (clr & 0xFF) / 0xFF, - ((clr >> 16) & 0xFF) * 0x101 * (clr & 0xFF) / 0xFF, - ((clr >> 8) & 0xFF) * 0x101 * (clr & 0xFF) / 0xFF, - (clr & 0xFF) * 0x101 - }; -} - -static void -drwl_setscheme(Drwl *drwl, uint32_t *scm) -{ - if (drwl) - drwl->scheme = scm; -} - -static Img * -drwl_image_create(Drwl *drwl, unsigned int w, unsigned int h, uint32_t *bits) -{ - Img *image; - pixman_region32_t clip; - - image = pixman_image_create_bits_no_clear( - PIXMAN_a8r8g8b8, w, h, bits, w * 4); - if (!image) - return NULL; - pixman_region32_init_rect(&clip, 0, 0, w, h); - pixman_image_set_clip_region32(image, &clip); - pixman_region32_fini(&clip); - - if (drwl) - drwl_setimage(drwl, image); - return image; -} - -static void -drwl_rect(Drwl *drwl, - int x, int y, unsigned int w, unsigned int h, - int filled, int invert) -{ - pixman_color_t clr; - if (!drwl || !drwl->scheme || !drwl->image) - return; - - clr = convert_color(drwl->scheme[invert ? ColBg : ColFg]); - if (filled) - pixman_image_fill_rectangles(PIXMAN_OP_SRC, drwl->image, &clr, 1, - &(pixman_rectangle16_t){x, y, w, h}); - else - pixman_image_fill_rectangles(PIXMAN_OP_SRC, drwl->image, &clr, 4, - (pixman_rectangle16_t[4]){ - { x, y, w, 1 }, - { x, y + h - 1, w, 1 }, - { x, y, 1, h }, - { x + w - 1, y, 1, h }}); -} - -static int -drwl_text(Drwl *drwl, - int x, int y, unsigned int w, unsigned int h, - unsigned int lpad, const char *text, int invert) -{ - int ty; - int render = x || y || w || h; - long x_kern; - uint32_t cp = 0, last_cp = 0, state; - pixman_color_t clr; - pixman_image_t *fg_pix = NULL; - int noellipsis = 0; - const struct fcft_glyph *glyph, *eg = NULL; - int fcft_subpixel_mode = FCFT_SUBPIXEL_DEFAULT; - - if (!drwl || (render && (!drwl->scheme || !w || !drwl->image)) || !text || !drwl->font) - return 0; - - if (!render) { - w = invert ? invert : ~invert; - } else { - clr = convert_color(drwl->scheme[invert ? ColBg : ColFg]); - fg_pix = pixman_image_create_solid_fill(&clr); - - drwl_rect(drwl, x, y, w, h, 1, !invert); - - x += lpad; - w -= lpad; - } - - if (render && (drwl->scheme[ColBg] & 0xFF) != 0xFF) - fcft_subpixel_mode = FCFT_SUBPIXEL_NONE; - - if (render) - eg = fcft_rasterize_char_utf32(drwl->font, 0x2026 /* … */, fcft_subpixel_mode); - - for (const char *p = text, *pp; pp = p, *p; p++) { - for (state = UTF8_ACCEPT; *p && - utf8decode(&state, &cp, *p) > UTF8_REJECT; p++) - ; - if (!*p || state == UTF8_REJECT) { - cp = UTF8_INVALID; - if (p > pp) - p--; - } - - glyph = fcft_rasterize_char_utf32(drwl->font, cp, fcft_subpixel_mode); - if (!glyph) - continue; - - x_kern = 0; - if (last_cp) - fcft_kerning(drwl->font, last_cp, cp, &x_kern, NULL); - last_cp = cp; - - ty = y + (h - drwl->font->height) / 2 + drwl->font->ascent; - - if (render && !noellipsis && x_kern + glyph->advance.x + eg->advance.x > w && - *(p + 1) != '\0') { - /* cannot fit ellipsis after current codepoint */ - if (drwl_text(drwl, 0, 0, 0, 0, 0, pp, 0) + x_kern <= w) { - noellipsis = 1; - } else { - w -= eg->advance.x; - pixman_image_composite32( - PIXMAN_OP_OVER, fg_pix, eg->pix, drwl->image, 0, 0, 0, 0, - x + eg->x, ty - eg->y, eg->width, eg->height); - } - } - - if ((x_kern + glyph->advance.x) > w) - break; - - x += x_kern; - - if (render && pixman_image_get_format(glyph->pix) == PIXMAN_a8r8g8b8) - /* pre-rendered glyphs (eg. emoji) */ - pixman_image_composite32( - PIXMAN_OP_OVER, glyph->pix, NULL, drwl->image, 0, 0, 0, 0, - x + glyph->x, ty - glyph->y, glyph->width, glyph->height); - else if (render) - pixman_image_composite32( - PIXMAN_OP_OVER, fg_pix, glyph->pix, drwl->image, 0, 0, 0, 0, - x + glyph->x, ty - glyph->y, glyph->width, glyph->height); - - x += glyph->advance.x; - w -= glyph->advance.x; - } - - if (render) - pixman_image_unref(fg_pix); - - return x + (render ? w : 0); -} - -static unsigned int -drwl_font_getwidth(Drwl *drwl, const char *text) -{ - if (!drwl || !drwl->font || !text) - return 0; - return drwl_text(drwl, 0, 0, 0, 0, 0, text, 0); -} - -static void -drwl_image_destroy(Img *image) -{ - pixman_image_unref(image); -} - -static void -drwl_destroy(Drwl *drwl) -{ - if (drwl->font) - drwl_font_destroy(drwl->font); - if (drwl->image) - drwl_image_destroy(drwl->image); - free(drwl); -} - -static void -drwl_fini(void) -{ - fcft_fini(); -} diff --git a/dwl.c b/dwl.c index 16203c6..4e7e6f2 100644 --- a/dwl.c +++ b/dwl.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -62,7 +61,6 @@ #include #include #include -#include #include #include #include @@ -75,7 +73,6 @@ #include "dwl-ipc-unstable-v2-protocol.h" #include "util.h" -#include "drwl.h" /* macros */ #define MAX(A, B) ((A) > (B) ? (A) : (B)) @@ -84,17 +81,14 @@ #define VISIBLEON(C, M) ((M) && (C)->mon == (M) && (((C)->tags & (M)->tagset[(M)->seltags]) || C->issticky)) #define LENGTH(X) (sizeof X / sizeof X[0]) #define END(A) ((A) + LENGTH(A)) -#define TAGMASK ((1u << LENGTH(tags)) - 1) +#define TAGMASK ((1u << TAGCOUNT) - 1) #define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L))) #define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0) -#define TEXTW(mon, text) (drwl_font_getwidth(mon->drw, text) + mon->lrpad) /* enums */ -enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */ enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */ enum { XDGShell, LayerShell, X11 }; /* client types */ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */ -enum { ClkTagBar, ClkLtSymbol, ClkStatus, ClkTitle, ClkClient, ClkRoot }; /* clicks */ #ifdef XWAYLAND enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar, NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */ @@ -109,7 +103,6 @@ typedef union { } Arg; typedef struct { - unsigned int click; unsigned int mod; unsigned int button; void (*func)(const Arg *); @@ -222,20 +215,11 @@ typedef struct { void (*arrange)(Monitor *); } Layout; -typedef struct { - struct wlr_buffer base; - struct wl_listener release; - bool busy; - Img *image; - uint32_t data[]; -} Buffer; - struct Monitor { struct wl_list link; struct wl_list dwl_ipc_outputs; struct wlr_output *wlr_output; struct wlr_scene_output *scene_output; - struct wlr_scene_buffer *scene_buffer; /* bar buffer */ struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */ struct wl_listener frame; struct wl_listener destroy; @@ -243,11 +227,6 @@ struct Monitor { struct wl_listener destroy_lock_surface; struct wlr_session_lock_surface_v1 *lock_surface; struct wlr_box m; /* monitor area, layout-relative */ - struct { - int width, height; - int real_width, real_height; /* non-scaled */ - float scale; - } b; /* bar area */ struct wlr_box w; /* window area, layout-relative */ struct wl_list layers[4]; /* LayerSurface.link */ const Layout *lt[2]; @@ -264,9 +243,6 @@ struct Monitor { int nmaster; char ltsymbol[16]; int asleep; - Drwl *drw; - Buffer *pool[2]; - int lrpad; }; typedef struct { @@ -312,13 +288,6 @@ static void arrangelayer(Monitor *m, struct wl_list *list, static void arrangelayers(Monitor *m); static void autostartexec(void); static void axisnotify(struct wl_listener *listener, void *data); -static bool baracceptsinput(struct wlr_scene_buffer *buffer, double *sx, double *sy); -static void bufdestroy(struct wlr_buffer *buffer); -static bool bufdatabegin(struct wlr_buffer *buffer, uint32_t flags, - void **data, uint32_t *format, size_t *stride); -static void bufdataend(struct wlr_buffer *buffer); -static Buffer *bufmon(Monitor *m); -static void bufrelease(struct wl_listener *listener, void *data); static void buttonpress(struct wl_listener *listener, void *data); static int ongesture(struct wlr_pointer_swipe_end_event *event); static void swipe_begin(struct wl_listener *listener, void *data); @@ -364,9 +333,6 @@ static void destroysessionlock(struct wl_listener *listener, void *data); static void destroysessionmgr(struct wl_listener *listener, void *data); static void destroykeyboardgroup(struct wl_listener *listener, void *data); static Monitor *dirtomon(enum wlr_direction dir); -static void drawbar(Monitor *m); -static void drawbars(void); -static int drawstatus(Monitor *m); static void dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id); static void dwl_ipc_manager_destroy(struct wl_resource *resource); static void dwl_ipc_manager_get_output(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *output); @@ -439,11 +405,9 @@ static void setsel(struct wl_listener *listener, void *data); static void setup(void); static void spawn(const Arg *arg); static void startdrag(struct wl_listener *listener, void *data); -static int statusin(int fd, unsigned int mask, void *data); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tile(Monitor *m); -static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void togglesticky(const Arg *arg); static void togglefullscreen(const Arg *arg); @@ -455,7 +419,6 @@ static void unlocksession(struct wl_listener *listener, void *data); static void unmaplayersurfacenotify(struct wl_listener *listener, void *data); static void unmapnotify(struct wl_listener *listener, void *data); static void updatemons(struct wl_listener *listener, void *data); -static void updatebar(Monitor *m); static void updatetitle(struct wl_listener *listener, void *data); static void urgent(struct wl_listener *listener, void *data); static void view(const Arg *arg); @@ -544,15 +507,6 @@ static uint32_t swipe_fingers = 0; static double swipe_dx = 0; static double swipe_dy = 0; -static int status_fd = -1; -static char stext[512]; -static struct wl_event_source *status_event_source; - -static const struct wlr_buffer_impl buffer_impl = { - .destroy = bufdestroy, - .begin_data_ptr_access = bufdatabegin, - .end_data_ptr_access = bufdataend, -}; #ifdef XWAYLAND static void activatex11(struct wl_listener *listener, void *data); @@ -735,11 +689,6 @@ arrangelayers(Monitor *m) if (!m->wlr_output->enabled) return; - if (m->scene_buffer->node.enabled) { - usable_area.height -= m->b.real_height; - usable_area.y += topbar ? m->b.real_height : 0; - } - /* Arrange exclusive surfaces from top->bottom */ for (i = 3; i >= 0; i--) arrangelayer(m, &m->layers[i], &usable_area, 1); @@ -803,102 +752,17 @@ axisnotify(struct wl_listener *listener, void *data) event->delta_discrete, event->source, event->relative_direction); } -bool -baracceptsinput(struct wlr_scene_buffer *buffer, double *sx, double *sy) -{ - return true; -} - -void -bufdestroy(struct wlr_buffer *wlr_buffer) -{ - Buffer *buf = wl_container_of(wlr_buffer, buf, base); - if (buf->busy) - wl_list_remove(&buf->release.link); - drwl_image_destroy(buf->image); - free(buf); -} - -bool -bufdatabegin(struct wlr_buffer *wlr_buffer, uint32_t flags, - void **data, uint32_t *format, size_t *stride) -{ - Buffer *buf = wl_container_of(wlr_buffer, buf, base); - - if (flags & WLR_BUFFER_DATA_PTR_ACCESS_WRITE) return false; - - *data = buf->data; - *stride = wlr_buffer->width * 4; - *format = DRM_FORMAT_ARGB8888; - - return true; -} - -void -bufdataend(struct wlr_buffer *wlr_buffer) -{ -} - -Buffer * -bufmon(Monitor *m) -{ - size_t i; - Buffer *buf = NULL; - - for (i = 0; i < LENGTH(m->pool); i++) { - if (m->pool[i]) { - if (m->pool[i]->busy) - continue; - buf = m->pool[i]; - break; - } - - buf = ecalloc(1, sizeof(Buffer) + (m->b.width * 4 * m->b.height)); - buf->image = drwl_image_create(NULL, m->b.width, m->b.height, buf->data); - wlr_buffer_init(&buf->base, &buffer_impl, m->b.width, m->b.height); - m->pool[i] = buf; - break; - } - if (!buf) - return NULL; - - buf->busy = true; - LISTEN(&buf->base.events.release, &buf->release, bufrelease); - wlr_buffer_lock(&buf->base); - drwl_setimage(m->drw, buf->image); - return buf; -} - -void -bufrelease(struct wl_listener *listener, void *data) -{ - Buffer *buf = wl_container_of(listener, buf, release); - buf->busy = false; - wl_list_remove(&buf->release.link); -} - void buttonpress(struct wl_listener *listener, void *data) { - unsigned int i = 0, x = 0, occ = 0; - double cx; - unsigned int click; struct wlr_pointer_button_event *event = data; struct wlr_keyboard *keyboard; - struct wlr_scene_node *node; - struct wlr_scene_buffer *buffer; uint32_t mods; - Arg arg = {0}; Client *c; const Button *b; wlr_idle_notifier_v1_notify_activity(idle_notifier, seat); - click = ClkRoot; - xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); - if (c) - click = ClkClient; - switch (event->state) { case WL_POINTER_BUTTON_STATE_PRESSED: cursor_mode = CurPressed; @@ -906,41 +770,17 @@ buttonpress(struct wl_listener *listener, void *data) if (locked) break; - if (!c && !exclusive_focus && - (node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) && - (buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) { - cx = (cursor->x - selmon->m.x) * selmon->wlr_output->scale; - wl_list_for_each(c, &clients, link) { - if (c->mon != selmon) - continue; - occ |= c->tags == TAGMASK ? 0 : c->tags; - } - do { - if (!(occ & 1 << i || selmon->tagset[selmon->seltags] & 1 << i)) - continue; - x += TEXTW(selmon, tags[i]); - } while (cursor->x >= x && ++i < LENGTH(tags)); - if (i < LENGTH(tags)) { - click = ClkTagBar; - arg.ui = 1 << i; - } else if (cx < x + TEXTW(selmon, selmon->ltsymbol)) - click = ClkLtSymbol; - else if (cx > selmon->b.width - (TEXTW(selmon, stext) - selmon->lrpad + 2)) { - click = ClkStatus; - } else - click = ClkTitle; - } - /* Change focus if the button was _pressed_ over a client */ xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); - if (click == ClkClient && (!client_is_unmanaged(c) || client_wants_focus(c))) + if (c && (!client_is_unmanaged(c) || client_wants_focus(c))) focusclient(c, 1); keyboard = wlr_seat_get_keyboard(seat); mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0; for (b = buttons; b < END(buttons); b++) { - if (CLEANMASK(mods) == CLEANMASK(b->mod) && event->button == b->button && click == b->click && b->func) { - b->func(click == ClkTagBar && b->arg.i == 0 ? &arg : &b->arg); + if (CLEANMASK(mods) == CLEANMASK(b->mod) && + event->button == b->button && b->func) { + b->func(&b->arg); return; } } @@ -1192,8 +1032,6 @@ cleanup(void) /* Destroy after the wayland display (when the monitors are already destroyed) to avoid destroying them with an invalid scene output. */ wlr_scene_node_destroy(&scene->tree.node); - - drwl_fini(); } void @@ -1213,12 +1051,6 @@ cleanupmon(struct wl_listener *listener, void *data) wlr_layer_surface_v1_destroy(l->layer_surface); } - for (i = 0; i < LENGTH(m->pool); i++) - wlr_buffer_drop(&m->pool[i]->base); - - drwl_setimage(m->drw, NULL); - drwl_destroy(m->drw); - wl_list_remove(&m->destroy.link); wl_list_remove(&m->frame.link); wl_list_remove(&m->link); @@ -1230,7 +1062,6 @@ cleanupmon(struct wl_listener *listener, void *data) free(m->pertag); closemon(m); wlr_scene_node_destroy(&m->fullscreen_bg->node); - wlr_scene_node_destroy(&m->scene_buffer->node); free(m); } @@ -1260,7 +1091,6 @@ closemon(Monitor *m) setmon(c, selmon, c->tags); } focusclient(focustop(selmon), 1); - drawbars(); printstatus(); } @@ -1539,16 +1369,8 @@ createmon(struct wl_listener *listener, void *data) wlr_output_commit_state(wlr_output, &state); wlr_output_state_finish(&state); - if (!(m->drw = drwl_create())) - die("failed to create drwl context"); - - m->scene_buffer = wlr_scene_buffer_create(layers[LyrBottom], NULL); - m->scene_buffer->point_accepts_input = baracceptsinput; - updatebar(m); - wl_list_insert(&mons, &m->link); printstatus(); - drawbars(); m->pertag = calloc(1, sizeof(Pertag)); m->pertag->curtag = m->pertag->prevtag = 1; @@ -2084,156 +1906,6 @@ dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource) wl_resource_destroy(resource); } -void -drawbar(Monitor *m) -{ - int x, w, tw = 0; - int boxs = m->drw->font->height / 9; - int boxw = m->drw->font->height / 6 + 2; - uint32_t i, occ = 0, urg = 0; - Client *c; - Buffer *buf; - - if (!m->scene_buffer->node.enabled) - return; - if (!(buf = bufmon(m))) - return; - - /* draw status first so it can be overdrawn by tags later */ - if (m == selmon || 1) /* status is only drawn on selected monitor */ - tw = drawstatus(m); - // else - // (void)drawstatus(m); - - wl_list_for_each(c, &clients, link) { - if (c->mon != m) - continue; - occ |= c->tags == TAGMASK ? 0 : c->tags; - if (c->isurgent) - urg |= c->tags; - } - x = 0; - c = focustop(m); - for (i = 0; i < LENGTH(tags); i++) { - if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) - continue; - w = TEXTW(m, tags[i]); - drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); - drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i); - x += w; - } - w = TEXTW(m, m->ltsymbol); - drwl_setscheme(m->drw, colors[SchemeNorm]); - x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0); - - if ((w = m->b.width - tw - x) > m->b.height) { - if (c) { - drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]); - drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0); - if (c && c->isfloating) - drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0); - } else { - drwl_setscheme(m->drw, colors[SchemeNorm]); - drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1); - } - } - - wlr_scene_buffer_set_dest_size(m->scene_buffer, - m->b.real_width, m->b.real_height); - wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x, - m->m.y + (topbar ? 0 : m->m.height - m->b.real_height)); - wlr_scene_buffer_set_buffer(m->scene_buffer, &buf->base); - wlr_buffer_unlock(&buf->base); -} - -void -drawbars(void) -{ - Monitor *m = NULL; - - wl_list_for_each(m, &mons, link) - drawbar(m); -} - -int -drawstatus(Monitor *m) -{ - int x, tw, iw; - char rstext[512] = ""; - char *p, *argstart, *argend, *itext; - uint32_t scheme[3], *color; - - /* calculate real width of stext */ - for (p = stext; *p; p++) { - if (*p == '^') { - p++; - if (!strncmp(p, "fg(", 3) || !strncmp(p, "bg(", 3)) { - argend = strchr(p, ')'); - if (!argend) - argend = p + 2; - p = argend; - } else if (*p == '^') { - strncat(rstext, p, 1); - } else { - strncat(rstext, p - 1, 2); - } - } else { - strncat(rstext, p, 1); - } - } - tw = TEXTW(m, rstext) - m->lrpad + 2; /* 2px right padding */ - - x = m->b.width - tw; - itext = stext; - scheme[0] = colors[SchemeNorm][0]; - scheme[1] = colors[SchemeNorm][1]; - drwl_setscheme(m->drw, scheme); - for (p = stext; *p; p++) { - if (*p == '^') { - p++; - if (!strncmp(p, "fg(", 3) || !strncmp(p, "bg(", 3)) { - *(p - 1) = '\0'; - iw = TEXTW(m, itext) - m->lrpad; - if (*itext) /* only draw text if there is something to draw */ - x = drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0); - *(p - 1) = '^'; - - argstart = p + 3; - argend = strchr(argstart, ')'); - if (!argend) argend = argstart - 1; - itext = argend + 1; - - if (!strncmp(p, "fg(", 3)) /* foreground */ - color = &scheme[0]; - else /* background */ - color = &scheme[1]; - - if (argend - argstart > 0) { - *argend = '\0'; - *color = strtoul(argstart, NULL, 16); - *color = *color << 8 | 0xff; /* add alpha channel */ - *argend = ')'; - } else { - *color = 0; - } - - /* reset color back to normal if none was provided */ - if (!scheme[0]) - scheme[0] = colors[SchemeNorm][0]; - if (!scheme[1]) - scheme[1] = colors[SchemeNorm][1]; - - drwl_setscheme(m->drw, scheme); - p = argend; - } - } - } - iw = TEXTW(m, itext) - m->lrpad; - if (*itext) - drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0); - return tw; -} - void focusclient(Client *c, int lift) { @@ -2269,13 +1941,13 @@ focusclient(Client *c, int lift) /* Don't change border color if there is an exclusive focus or we are * handling a drag operation */ if (!exclusive_focus && !seat->drag) - client_set_border_color(c, (float[])COLOR(colors[SchemeSel][ColBorder])); + client_set_border_color(c, focuscolor); } /* Deactivate old client if focus is changing */ if (old && (!c || client_surface(c) != old)) { /* If an overlay is focused, don't focus or activate the client, - * but only update its position in fstack to render its border with its color + * but only update its position in fstack to render its border with focuscolor * and focus it after the overlay is closed. */ if (old_client_type == LayerShell && wlr_scene_node_coords( &old_l->scene->node, &unused_lx, &unused_ly) @@ -2286,7 +1958,7 @@ focusclient(Client *c, int lift) /* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg * and probably other clients */ } else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) { - client_set_border_color(old_c, (float[])COLOR(colors[SchemeNorm][ColBorder])); + client_set_border_color(old_c, bordercolor); client_activate_surface(old, 0); if (old_c->foreign_toplevel) @@ -2294,7 +1966,6 @@ focusclient(Client *c, int lift) } } printstatus(); - drawbars(); if (!c) { /* With no client, all we have left is to clear focus */ @@ -2808,7 +2479,7 @@ mapnotify(struct wl_listener *listener, void *data) for (i = 0; i < 4; i++) { c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, - (float[])COLOR(colors[c->isurgent ? SchemeUrg : SchemeNorm][ColBorder])); + c->isurgent ? urgentcolor : bordercolor); c->border[i]->node.data = c; } @@ -2838,7 +2509,6 @@ mapnotify(struct wl_listener *listener, void *data) applyrules(c); } printstatus(); - drawbars(); unset_fullscreen: m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); @@ -3136,15 +2806,6 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, wlr_seat_pointer_notify_motion(seat, time, sx, sy); } -void -printstatus(void) -{ - Monitor *m = NULL; - - wl_list_for_each(m, &mons, link) - dwl_ipc_output_printstatus(m); -} - void powermgrsetmode(struct wl_listener *listener, void *data) { @@ -3162,41 +2823,58 @@ powermgrsetmode(struct wl_listener *listener, void *data) m->asleep = !event->mode; } +// void +// printstatus(void) +// { +// Monitor *m = NULL; +// Client *c; +// uint32_t occ, urg, sel; +// const char *appid, *title; +// +// wl_list_for_each(m, &mons, link) { +// occ = urg = 0; +// wl_list_for_each(c, &clients, link) { +// if (c->mon != m) +// continue; +// occ |= c->tags; +// if (c->isurgent) +// urg |= c->tags; +// } +// if ((c = focustop(m))) { +// title = client_get_title(c); +// appid = client_get_appid(c); +// printf("%s title %s\n", m->wlr_output->name, title ? title : broken); +// printf("%s appid %s\n", m->wlr_output->name, appid ? appid : broken); +// printf("%s fullscreen %d\n", m->wlr_output->name, c->isfullscreen); +// printf("%s floating %d\n", m->wlr_output->name, c->isfloating); +// sel = c->tags; +// } else { +// printf("%s title \n", m->wlr_output->name); +// printf("%s appid \n", m->wlr_output->name); +// printf("%s fullscreen \n", m->wlr_output->name); +// printf("%s floating \n", m->wlr_output->name); +// sel = 0; +// } +// +// printf("%s selmon %u\n", m->wlr_output->name, m == selmon); +// printf("%s tags %"PRIu32" %"PRIu32" %"PRIu32" %"PRIu32"\n", +// m->wlr_output->name, occ, m->tagset[m->seltags], sel, urg); +// printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol); +// } +// fflush(stdout); +// } + void -updatebar(Monitor *m) +printstatus(void) { - size_t i; - int rw, rh; - char fontattrs[12]; + Monitor *m = NULL; - wlr_output_transformed_resolution(m->wlr_output, &rw, &rh); - m->b.width = rw; - m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale); - - wlr_scene_node_set_enabled(&m->scene_buffer->node, m->wlr_output->enabled ? showbar : 0); - - for (i = 0; i < LENGTH(m->pool); i++) - if (m->pool[i]) { - wlr_buffer_drop(&m->pool[i]->base); - m->pool[i] = NULL; - } - - if (m->b.scale == m->wlr_output->scale && m->drw) - return; - - drwl_font_destroy(m->drw->font); - snprintf(fontattrs, sizeof(fontattrs), "dpi=%.2f", 96. * m->wlr_output->scale); - wlr_log(WLR_INFO, "fontattrs %s\n", fontattrs); - if (!(drwl_font_create(m->drw, LENGTH(fonts), fonts, fontattrs))) - die("Could not load font"); - - m->b.scale = m->wlr_output->scale; - m->lrpad = m->drw->font->height; - m->b.height = user_bh ? user_bh : m->drw->font->height + 2; - m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale); + wl_list_for_each(m, &mons, link) + dwl_ipc_output_printstatus(m); } + void quit(const Arg *arg) { @@ -3334,19 +3012,33 @@ run(char *startup_cmd) /* Now that the socket exists and the backend is started, run the startup command */ autostartexec(); if (startup_cmd) { + int piperw[2]; + if (pipe(piperw) < 0) + die("startup: pipe:"); + if ((child_pid = fork()) < 0) die("startup: fork:"); if (child_pid == 0) { - if (status_fd != -1) close(status_fd); - close(STDIN_FILENO); setsid(); + dup2(piperw[0], STDIN_FILENO); + close(piperw[0]); + close(piperw[1]); + execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL); die("startup: execl:"); } + + dup2(piperw[1], STDOUT_FILENO); + close(piperw[1]); + close(piperw[0]); } + /* Mark stdout as non-blocking to avoid people who does not close stdin + * nor consumes it in their startup script getting dwl frozen */ + if (fd_set_nonblock(STDOUT_FILENO) < 0) + close(STDOUT_FILENO); + printstatus(); - drawbars(); /* At this point the outputs are initialized, choose initial selmon based on * cursor position, and set default cursor image */ @@ -3413,7 +3105,6 @@ setfloating(Client *c, int floating) : c->isfloating ? LyrFloat : LyrTile]); arrange(c->mon); printstatus(); - drawbars(); } void @@ -3436,7 +3127,7 @@ setfullscreen(Client *c, int fullscreen) resize(c, c->prev, 0); } arrange(c->mon); - drawbars(); + printstatus(); } void @@ -3493,7 +3184,6 @@ setlayout(const Arg *arg) selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol)); arrange(selmon); - drawbar(selmon); printstatus(); } @@ -3572,7 +3262,6 @@ setup(void) for (i = 0; i < (int)LENGTH(sig); i++) sigaction(sig[i], &sa, NULL); - wlr_log_init(log_level, NULL); /* The Wayland display is managed by libwayland. It handles accepting @@ -3777,30 +3466,6 @@ setup(void) wl_global_create(dpy, &zdwl_ipc_manager_v2_interface, 2, NULL, dwl_ipc_manager_bind); - drwl_init(); - - // create file descriptor for status input if not already created in XDG_RUNTIME_DIR - const char status_file[256]; - snprintf(status_file, sizeof(status_file), "%s/dwl_status", getenv("XDG_RUNTIME_DIR")); - - FILE* status_f = fopen(status_file, "r"); - if (status_f == NULL) { - status_f = fopen(status_file, "w"); - if (status_f == NULL) { - wlr_log(WLR_ERROR, "Failed to create status file %s\n", status_file); - exit(1); - } - fclose(status_f); - status_f = fopen(status_file, "r"); - } - status_fd = fileno(status_f); - wlr_log(WLR_INFO, "Status file fd %d\n", status_fd); - - // status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy), - // STDIN_FILENO, WL_EVENT_READABLE, statusin, NULL); - status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy), - status_fd, WL_EVENT_READABLE, statusin, NULL); - /* Make sure XWayland clients don't connect to the parent X server, * e.g when running in the x11 backend or the wayland backend and the * compositor has Xwayland support */ @@ -3825,8 +3490,6 @@ void spawn(const Arg *arg) { if (fork() == 0) { - if (status_fd != -1) close(status_fd); - close(STDIN_FILENO); dup2(STDERR_FILENO, STDOUT_FILENO); setsid(); execvp(((char **)arg->v)[0], (char **)arg->v); @@ -3845,37 +3508,6 @@ startdrag(struct wl_listener *listener, void *data) LISTEN_STATIC(&drag->icon->events.destroy, destroydragicon); } -int -statusin(int fd, unsigned int mask, void *data) -{ - if (fd == -1) { - return 0; - } - - char status[1024]; - ssize_t n; - - if (mask & WL_EVENT_ERROR) - die("status in event error"); - if (mask & WL_EVENT_HANGUP) - wl_event_source_remove(status_event_source); - - n = read(fd, status, sizeof(status) - 1); - if (n < 0 && errno != EWOULDBLOCK) - die("read:"); - - status[n] = '\0'; - status[strcspn(status, "\n")] = '\0'; - - strncpy(stext, status, sizeof(stext)); - drawbars(); - - wlr_log(WLR_INFO, "Reading from %d\n", fd); - wlr_log(WLR_INFO, "Status %s\n", stext); - - return 0; -} - void tag(const Arg *arg) { @@ -3887,7 +3519,6 @@ tag(const Arg *arg) focusclient(focustop(selmon), 1); arrange(selmon); printstatus(); - drawbars(); } void @@ -3941,17 +3572,6 @@ tile(Monitor *m) } } -void -togglebar(const Arg *arg) -{ - DwlIpcOutput *ipc_output; - wl_list_for_each(ipc_output, &selmon->dwl_ipc_outputs, link) - zdwl_ipc_output_v2_send_toggle_visibility(ipc_output->resource); - - wlr_scene_node_set_enabled(&selmon->scene_buffer->node, - !selmon->scene_buffer->node.enabled); - arrangelayers(selmon); -} void togglefloating(const Arg *arg) @@ -3960,6 +3580,7 @@ togglefloating(const Arg *arg) /* return if fullscreen */ if (sel && !sel->isfullscreen) setfloating(sel, !sel->isfloating); + printstatus(); } void @@ -4007,7 +3628,6 @@ toggletag(const Arg *arg) focusclient(focustop(selmon), 1); arrange(selmon); printstatus(); - drawbars(); } void @@ -4041,7 +3661,6 @@ toggleview(const Arg *arg) focusclient(focustop(selmon), 1); arrange(selmon); printstatus(); - drawbars(); } void @@ -4112,7 +3731,6 @@ unmapnotify(struct wl_listener *listener, void *data) wlr_scene_node_destroy(&c->scene->node); printstatus(); - drawbars(); motionnotify(0, NULL, 0, 0, 0, 0); } @@ -4212,13 +3830,6 @@ updatemons(struct wl_listener *listener, void *data) } } - if (stext[0] == '\0') - strncpy(stext, "dwl-"VERSION, sizeof(stext)); - wl_list_for_each(m, &mons, link) { - updatebar(m); - drawbar(m); - } - /* FIXME: figure out why the cursor image is at 0,0 after turning all * the monitors on. * Move the cursor image where it used to be. It does not generate a @@ -4241,7 +3852,6 @@ updatetitle(struct wl_listener *listener, void *data) } if (c == focustop(c->mon)) { printstatus(); - drawbars(); } } @@ -4256,10 +3866,9 @@ urgent(struct wl_listener *listener, void *data) c->isurgent = 1; printstatus(); - drawbars(); if (client_surface(c)->mapped) - client_set_border_color(c, (float[])COLOR(colors[SchemeUrg][ColBorder])); + client_set_border_color(c, urgentcolor); } void @@ -4295,7 +3904,6 @@ view(const Arg *arg) focusclient(focustop(selmon), 1); arrange(selmon); printstatus(); - drawbars(); } void @@ -4336,7 +3944,6 @@ xytonode(double x, double y, struct wlr_surface **psurface, { struct wlr_scene_node *node, *pnode; struct wlr_surface *surface = NULL; - struct wlr_scene_surface *scene_surface = NULL; Client *c = NULL; LayerSurface *l = NULL; int layer; @@ -4345,12 +3952,9 @@ xytonode(double x, double y, struct wlr_surface **psurface, if (!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny))) continue; - if (node->type == WLR_SCENE_NODE_BUFFER) { - scene_surface = wlr_scene_surface_try_from_buffer( - wlr_scene_buffer_from_node(node)); - if (!scene_surface) continue; - surface = scene_surface->surface; - } + if (node->type == WLR_SCENE_NODE_BUFFER) + surface = wlr_scene_surface_try_from_buffer( + wlr_scene_buffer_from_node(node))->surface; /* Walk the tree to find a node that knows the client */ for (pnode = node; pnode && !c; pnode = &pnode->parent->node) c = pnode->data; @@ -4538,10 +4142,9 @@ sethints(struct wl_listener *listener, void *data) c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); printstatus(); - drawbars(); if (c->isurgent && surface && surface->mapped) - client_set_border_color(c, (float[])COLOR(colors[SchemeUrg][ColBorder])); + client_set_border_color(c, urgentcolor); } void