aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-09-22 17:38:40 +0530
committersinanmohd <sinan@firemail.cc>2023-09-22 17:55:42 +0530
commit57c70b14a494dfaa05181cdafed8ea8bb979520d (patch)
treebab70d8137dfada2ddca4d4840955fe0f7f957c0
parent2dd280bbd70d032e940c41ffa738baadd6580c4d (diff)
swallow: revert old patch and connected commits
reverts the following commits - 2b762d51db37f09e0c2b55f25f09adba830309bc. - 63aef569a297ad7be5af07818b15fca40407e740. - 1df76c9893e6314cbea6d112a5d6ad35a99ee7fb. - ab7a170f3f79b1f3afb8002ced4fbfd5aef84d69.
-rw-r--r--config.def.h9
-rw-r--r--dwl.c106
2 files changed, 10 insertions, 105 deletions
diff --git a/config.def.h b/config.def.h
index 7c7e97f..d4b4fe0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,10 +13,11 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
static const int tagcount = 9;
static const Rule rules[] = {
- /* app_id title tags mask isfloating isterm noswallow monitor */
- { "wev", NULL, 0, 0, 0, 1, -1 },
- { "foot", NULL, 0, 0, 1, 0, -1 },
- { "firefox", NULL, 1 << 8, 0, 0, 1, -1 },
+ /* app_id title tags mask isfloating monitor */
+ /* examples:
+ { "Gimp", NULL, 0, 1, -1 },
+ */
+ { "firefox", NULL, 1 << 8, 0, -1 },
};
/* layout(s) */
diff --git a/dwl.c b/dwl.c
index 109ae26..05b5f29 100644
--- a/dwl.c
+++ b/dwl.c
@@ -95,8 +95,7 @@ typedef struct {
} Button;
typedef struct Monitor Monitor;
-typedef struct Client Client;
-struct Client {
+typedef struct {
/* Must keep these three elements in this order */
unsigned int type; /* XDGShell or X11* */
struct wlr_box geom; /* layout-relative, includes border */
@@ -124,12 +123,10 @@ struct Client {
struct wl_listener set_hints;
#endif
unsigned int bw;
- int isfloating, isurgent, isfullscreen, isterm, noswallow;
uint32_t tags;
+ int isfloating, isurgent, isfullscreen;
uint32_t resize; /* configure serial of a pending resize */
- pid_t pid;
- Client *swallowing, *swallowedby;
-};
+} Client;
typedef struct {
uint32_t mod;
@@ -211,8 +208,6 @@ typedef struct {
const char *title;
uint32_t tags;
int isfloating;
- int isterm;
- int noswallow;
int monitor;
} Rule;
@@ -323,10 +318,6 @@ static Monitor *xytomon(double x, double y);
static struct wlr_scene_node *xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny);
static void zoom(const Arg *arg);
-static pid_t getparentprocess(pid_t p);
-static int isdescprocess(pid_t p, pid_t c);
-static Client *termforwin(Client *w);
-static void swallow(Client *c, Client *w);
/* variables */
static const char broken[] = "broken";
@@ -470,8 +461,6 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating;
- c->isterm = r->isterm;
- c->noswallow = r->noswallow;
newtags |= r->tags;
i = 0;
wl_list_for_each(m, &mons, link)
@@ -1024,8 +1013,6 @@ createnotify(struct wl_listener *listener, void *data)
c->surface.xdg = xdg_surface;
c->bw = borderpx;
- wl_client_get_credentials(c->surface.xdg->client->client, &c->pid, NULL, NULL);
-
LISTEN(&xdg_surface->events.map, &c->map, mapnotify);
LISTEN(&xdg_surface->events.unmap, &c->unmap, unmapnotify);
LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
@@ -1064,7 +1051,7 @@ createpointer(struct wlr_pointer *pointer)
if (libinput_device_config_scroll_get_methods(libinput_device) != LIBINPUT_CONFIG_SCROLL_NO_SCROLL)
libinput_device_config_scroll_set_method (libinput_device, scroll_method);
-
+
if (libinput_device_config_click_get_methods(libinput_device) != LIBINPUT_CONFIG_CLICK_METHOD_NONE)
libinput_device_config_click_set_method (libinput_device, click_method);
@@ -1350,62 +1337,6 @@ fullscreennotify(struct wl_listener *listener, void *data)
setfullscreen(c, client_wants_fullscreen(c));
}
-pid_t
-getparentprocess(pid_t p)
-{
- unsigned int v = 0;
-
- FILE *f;
- char buf[256];
- snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
-
- if (!(f = fopen(buf, "r")))
- return 0;
-
- fscanf(f, "%*u %*s %*c %u", &v);
- fclose(f);
-
- return (pid_t)v;
-}
-
-int
-isdescprocess(pid_t p, pid_t c)
-{
- while (p != c && c != 0)
- c = getparentprocess(c);
-
- return (int)c;
-}
-
-Client *
-termforwin(Client *w)
-{
- Client *c;
-
- if (!w->pid || w->isterm || w->noswallow)
- return NULL;
-
- wl_list_for_each(c, &clients, link)
- if (c->isterm && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid))
- return c;
-
- return NULL;
-}
-
-void
-swallow(Client *c, Client *w)
-{
- c->bw = w->bw;
- c->isfloating = w->isfloating;
- c->isurgent = w->isurgent;
- c->isfullscreen = w->isfullscreen;
- resize(c, w->geom, 0);
- wl_list_insert(&w->link, &c->link);
- wl_list_insert(&w->flink, &c->flink);
- wlr_scene_node_set_enabled(&w->scene->node, 0);
- wlr_scene_node_set_enabled(&c->scene->node, 1);
-}
-
int
handlesig(int signo, void *data)
{
@@ -1612,7 +1543,7 @@ void
mapnotify(struct wl_listener *listener, void *data)
{
/* Called when the surface is mapped, or ready to display on-screen. */
- Client *p, *w, *t, *c = wl_container_of(listener, c, map);
+ Client *p, *w, *c = wl_container_of(listener, c, map);
Monitor *m;
int i;
@@ -1673,20 +1604,6 @@ mapnotify(struct wl_listener *listener, void *data)
}
printstatus();
- if (!c->noswallow) {
- t = termforwin(c);
- if (t) {
- c->swallowedby = t;
- t->swallowing = c;
- wl_list_remove(&c->link);
- wl_list_remove(&c->flink);
- swallow(c,t);
- wl_list_remove(&t->link);
- wl_list_remove(&t->flink);
- arrange(c->mon);
- }
- }
-
unset_fullscreen:
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
wl_list_for_each(w, &clients, link)
@@ -2571,18 +2488,6 @@ unmapnotify(struct wl_listener *listener, void *data)
grabc = NULL;
}
- if (c->swallowing) {
- c->swallowing->swallowedby = NULL;
- c->swallowing = NULL;
- }
-
- if (c->swallowedby) {
- setfullscreen(c->swallowedby, 0);
- swallow(c->swallowedby, c);
- c->swallowedby->swallowing = NULL;
- c->swallowedby = NULL;
- }
-
if (client_is_unmanaged(c)) {
if (c == exclusive_focus)
exclusive_focus = NULL;
@@ -2929,4 +2834,3 @@ main(int argc, char *argv[])
usage:
die("Usage: %s [-v] [-s startup command]", argv[0]);
}
-