From c6dd1ec3b3d71a979f106879669a15d94cfed6ef Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Fri, 29 Apr 2016 15:52:16 +0200 Subject: Apply patches for dgit. --- cmd/wmii/Makefile | 4 ++-- cmd/wmii/client.c | 2 +- cmd/wmii/column.c | 4 ++-- cmd/wmii/dat.h | 10 ++++++++-- cmd/wmii/fns.h | 4 +++- cmd/wmii/frame.c | 5 +++-- cmd/wmii/main.c | 48 +++++++++++++++++++++++++++++++++++++++--------- cmd/wmii/message.c | 22 +++++++++++++++++++++- cmd/wmii/view.c | 41 +++++++++++++++++++++++++++++++++++++++-- 9 files changed, 118 insertions(+), 22 deletions(-) (limited to 'cmd/wmii') diff --git a/cmd/wmii/Makefile b/cmd/wmii/Makefile index b5d41c4..e527387 100644 --- a/cmd/wmii/Makefile +++ b/cmd/wmii/Makefile @@ -10,8 +10,8 @@ TAGFILES = dat.h PACKAGES += $(X11PACKAGES) xext xrandr xrender xinerama -LIB = $(LIBIXP) $(LIBS9) -LIBS += -lm +LIB = $(LIBS9) +LIBS += -lm $(LIBIXP) OBJ = area \ bar \ diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c index c119bd0..5a7224e 100644 --- a/cmd/wmii/client.c +++ b/cmd/wmii/client.c @@ -1,5 +1,5 @@ /* Copyright ©2004-2006 Anselm R. Garbe - * Copyright ©2006-2010 Kris Maglione + * Copyright ©2006-2014 Kris Maglione * See LICENSE file for license details. */ #include "dat.h" diff --git a/cmd/wmii/column.c b/cmd/wmii/column.c index 098e964..25a9567 100644 --- a/cmd/wmii/column.c +++ b/cmd/wmii/column.c @@ -1,5 +1,5 @@ /* Copyright ©2004-2006 Anselm R. Garbe - * Copyright ©2006-2010 Kris Maglione + * Copyright ©2006-2014 Kris Maglione * See LICENSE file for license details. */ #include "dat.h" @@ -156,7 +156,7 @@ column_detach(Frame *f) { if(first) stack_scale(first, dy); column_arrange(a, false); - }else if(a->view->areas[a->screen]->next) + }else if(a->view->areas[a->screen]->next && !a->permanent) column_destroy(a); } diff --git a/cmd/wmii/dat.h b/cmd/wmii/dat.h index 1b32f9a..1a3fc3e 100644 --- a/cmd/wmii/dat.h +++ b/cmd/wmii/dat.h @@ -1,4 +1,4 @@ -/* Copyright ©2007-2010 Kris Maglione +/* Copyright ©2007-2014 Kris Maglione * See LICENSE file for license details. */ @@ -18,7 +18,11 @@ #include #include "debug.h" -#define FONT "fixed" +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + +#define FONT "-*-fixed-medium-r-*-*-*-120-75-75-c-60-iso10646-" #define FOCUSCOLORS "#000000 #81654f #000000" #define NORMCOLORS "#000000 #c1c48b #81654f" @@ -149,6 +153,7 @@ struct Area { int mode; int screen; bool max; + bool permanent; Rectangle r; Rectangle r_old; }; @@ -371,6 +376,7 @@ EXTERN long ignoreenter; EXTERN bool resizing; EXTERN int starting; EXTERN char* user; +EXTERN long nscreens_new; EXTERN Client* kludge; diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h index cc2e7e0..a0da74d 100644 --- a/cmd/wmii/fns.h +++ b/cmd/wmii/fns.h @@ -1,4 +1,4 @@ -/* Copyright ©2007-2010 Kris Maglione +/* Copyright ©2007-2014 Kris Maglione * See LICENSE file for license details. */ @@ -207,6 +207,7 @@ void update_keys(void); /* main.c */ void init_screens(void); void spawn_command(const char*); +void wipe_screens(void); /* message.c */ char* mask(char**, int*, int*); @@ -280,6 +281,7 @@ void view_select(const char*); void view_update(View*); void view_update_all(void); void view_update_rect(View*); +void view_update_screens(View*); void view_update_urgency(View*, char*); Rectangle* view_rects(View*, uint *num, Frame *ignore); diff --git a/cmd/wmii/frame.c b/cmd/wmii/frame.c index 3c1a838..85f7f82 100644 --- a/cmd/wmii/frame.c +++ b/cmd/wmii/frame.c @@ -1,4 +1,4 @@ -/* Copyright ©2006-2010 Kris Maglione +/* Copyright ©2006-2014 Kris Maglione * See LICENSE file for license details. */ #include "dat.h" @@ -559,7 +559,8 @@ move_focus(Frame *old_f, Frame *f) { noinput = (old_f && old_f->client->noinput) || (f && f->client->noinput) || disp.hasgrab != &c_root; - if(noinput) { + + if(noinput || true) { if(old_f) frame_draw(old_f); if(f) diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c index e58b858..fc5f43a 100644 --- a/cmd/wmii/main.c +++ b/cmd/wmii/main.c @@ -1,5 +1,5 @@ /* Copyright ©2004-2006 Anselm R. Garbe - * Copyright ©2006-2010 Kris Maglione + * Copyright ©2006-2014 Kris Maglione * See LICENSE file for license details. */ #define EXTERN @@ -158,12 +158,14 @@ regerror(char *err) { fprint(2, "%s: %s\n", argv0, err); } +static bool keep_screens = true; + void init_screens(void) { static int old_n, old_nscreens; - Rectangle *rects; + Rectangle *rects, *r; View *v; - int i, n, m; + int i, j, n, m; #ifdef notdef d.x = Dx(scr.rect) - Dx(screen->r); @@ -176,15 +178,33 @@ init_screens(void) { /* Reallocate screens, zero any new ones. */ rects = xinerama_screens(&n); + r = malloc(n * sizeof *r); + + /* Weed out subsumed/cloned screens */ + for(m=-1; m < n; n=m) { + for(i=n-1, m=0; i >= 0; i--) { + for(j=0; j < n; j++) + if (i != j && + eqrect(rects[i], + rect_intersection(rects[i], rects[j]))) + break; + if (j == n) + r[m++] = rects[i]; + } + for(i=m-1, j=0; i >= 0; i--) + rects[j++] = r[i]; + } + free(r); + m = nscreens; - nscreens = max(n, nscreens); + nscreens_new = keep_screens ? max(n, nscreens) : n; + + for(v=view; v; v=v->next) + view_update_screens(v); + + nscreens = nscreens_new; screens = erealloc(screens, (nscreens + 1) * sizeof *screens); screens[nscreens] = nil; - for(v=view; v; v=v->next) { - v->areas = erealloc(v->areas, nscreens * sizeof *v->areas); - v->r = erealloc(v->r, nscreens * sizeof *v->r); - v->pad = erealloc(v->pad, nscreens * sizeof *v->pad); - } /* Reallocate buffers. */ freeimage(disp.ibuf); @@ -207,9 +227,11 @@ init_screens(void) { screen->r = rects[i]; else screen->r = rectsetorigin(screen->r, scr.rect.max); + if(i >= m) for(v=view; v; v=v->next) view_init(v, i); + def.snap = Dy(screen->r) / 63; bar_init(screens[i]); } @@ -219,10 +241,18 @@ init_screens(void) { if (old_n != n || old_nscreens != nscreens) event("ScreenChange %d %d\n", n, nscreens); + old_n = n; old_nscreens = nscreens; } +void +wipe_screens(void) { + keep_screens = false; + init_screens(); + keep_screens = true; +} + static void cleanup(void) { starting = -1; diff --git a/cmd/wmii/message.c b/cmd/wmii/message.c index d392ad0..0127605 100644 --- a/cmd/wmii/message.c +++ b/cmd/wmii/message.c @@ -1,4 +1,4 @@ -/* Copyright ©2006-2010 Kris Maglione +/* Copyright ©2006-2014 Kris Maglione * See LICENSE file for license details. */ #include "dat.h" @@ -62,6 +62,7 @@ enum { LUP, LURGENT, LVIEW, + LWIPESCREENS, LTILDE, }; char *symtab[] = { @@ -103,6 +104,7 @@ char *symtab[] = { "up", "urgent", "view", + "wipescreens", "~", }; @@ -609,26 +611,33 @@ message_root(void *p, IxpMsg *m) { setdef(&screen->barpos, s, barpostab, nelem(barpostab)); view_update(selview); break; + case LBORDER: def.border = msg_getulong(msg_getword(m, 0));; view_update(selview); break; + case LCOLMODE: setdef(&def.colmode, msg_getword(m, 0), modes, Collast); break; + case LDEBUG: msg_debug(msg_getword(m, 0)); break; + case LEXEC: execstr = strdup(m->pos); srv.running = 0; break; + case LSPAWN: spawn_command(m->pos); break; + case LFOCUSCOLORS: msg_parsecolors(m, &def.focuscolor); goto updatecolors; + case LFONT: fn = loadfont(m->pos); if(fn) { @@ -640,6 +649,7 @@ message_root(void *p, IxpMsg *m) { ret = "can't load font"; view_update(selview); break; + case LFONTPAD: if(!getint(msg_getword(m, 0), &def.font->pad.min.x) || !getint(msg_getword(m, 0), &def.font->pad.max.x) || @@ -652,6 +662,7 @@ message_root(void *p, IxpMsg *m) { view_update(selview); } break; + case LGRABMOD: s = msg_getword(m, Ebadvalue); if(!parsekey(s, &i, nil) || i == 0) @@ -659,10 +670,12 @@ message_root(void *p, IxpMsg *m) { def.mod = i; break; + case LINCMODE: setdef(&def.incmode, msg_getword(m, 0), incmodetab, nelem(incmodetab)); view_update(selview); break; + case LNORMCOLORS: msg_parsecolors(m, &def.normcolor); updatecolors: @@ -670,12 +683,19 @@ message_root(void *p, IxpMsg *m) { client_reparent(c); view_update(selview); break; + case LSELCOLORS: warning("selcolors have been removed"); return Ebadcmd; + case LVIEW: view_select(m->pos); break; + + case LWIPESCREENS: + wipe_screens(); + break; + case LQUIT: srv.running = 0; break; diff --git a/cmd/wmii/view.c b/cmd/wmii/view.c index 5bf43c5..4aa3d29 100644 --- a/cmd/wmii/view.c +++ b/cmd/wmii/view.c @@ -1,5 +1,5 @@ /* Copyright ©2004-2006 Anselm R. Garbe - * Copyright ©2006-2010 Kris Maglione + * Copyright ©2006-2014 Kris Maglione * See LICENSE file for license details. */ #include "dat.h" @@ -112,6 +112,38 @@ view_init(View *v, int iscreen) { column_new(v, nil, iscreen, 0); } +void +view_update_screens(View *v) { + Area *a; + Frame *f; + int s; + + if (v->sel->screen > (long)nscreens) + v->sel = v->floating->next; + + v->selscreen = min(v->selscreen, nscreens); + + if (nscreens_new < nscreens) { + foreach_frame(v, s, a, f) { + f->oldscreen = min(f->oldscreen, nscreens_new); + if (a->screen >= nscreens_new) { + a->permanent = true; + area_detach(f); + view_attach(v, f); + } + } + + foreach_area(v, s, a) { + if (a->screen >= nscreens_new) + area_destroy(a); + } + } + + v->areas = erealloc(v->areas, nscreens_new * sizeof *v->areas); + v->r = erealloc(v->r, nscreens_new * sizeof *v->r); + v->pad = erealloc(v->pad, nscreens_new * sizeof *v->pad); +} + void view_destroy(View *v) { View **vp; @@ -385,6 +417,7 @@ view_attach(View *v, Frame *f) { oldsel = v->oldsel; a = v->sel; + if(c->floating == Never) a = view_findarea(v, v->selscreen, v->selcol, false); else if(client_floats_p(c)) { @@ -392,8 +425,12 @@ view_attach(View *v, Frame *f) { oldsel = v->sel; a = v->floating; } + else if(c->sel && c->sel->screen >= 0 && c->sel->screen < nscreens_new && + c->sel->screen != v->sel->screen) + a = view_findarea(v, c->sel->screen, 0, false); else if((ff = client_groupframe(c, v))) { - a = ff->area; + if (ff->client != c && ff->area->screen < nscreens_new) + a = ff->area; if(v->oldsel && ff->client == view_selclient(v)) a = v->oldsel; } -- cgit v1.2.3