mirror of
https://github.com/0intro/wmii
synced 2025-01-06 02:22:01 +03:00
snap value is calculated dynamically now
This commit is contained in:
parent
5e2c219f0e
commit
9d37029fe9
@ -10,6 +10,8 @@
|
||||
|
||||
#include "wm.h"
|
||||
|
||||
#define CLIENT_MASK (StructureNotifyMask | PropertyChangeMask)
|
||||
|
||||
Client *
|
||||
alloc_client(Window w, XWindowAttributes *wa)
|
||||
{
|
||||
|
24
cmd/wm/fs.c
24
cmd/wm/fs.c
@ -36,7 +36,6 @@ static unsigned int nqueue = 0, queuesz = 0;
|
||||
* / FsDroot
|
||||
* /def/ FsDdef
|
||||
* /def/border FsFborder 0..n
|
||||
* /def/snap FsFsnap 0..n
|
||||
* /def/font FsFfont xlib font name
|
||||
* /def/selcolors FsFselcolors sel color
|
||||
* /def/normcolors FsFnormcolors normal colors
|
||||
@ -201,7 +200,6 @@ qid2name(Qid *qid)
|
||||
break;
|
||||
case FsFctl: return "ctl"; break;
|
||||
case FsFborder: return "border"; break;
|
||||
case FsFsnap: return "snap"; break;
|
||||
case FsFgeom:
|
||||
if((qid->dir_type == FsDclient) && (i1 == -1 || i2 == -1 || i3 == -1))
|
||||
return nil;
|
||||
@ -257,8 +255,6 @@ name2type(char *name, unsigned char dir_type)
|
||||
return FsFctl;
|
||||
if(!strncmp(name, "event", 6))
|
||||
return FsFevent;
|
||||
if(!strncmp(name, "snap", 5))
|
||||
return FsFsnap;
|
||||
if(!strncmp(name, "class", 5))
|
||||
return FsFclass;
|
||||
if(!strncmp(name, "name", 5))
|
||||
@ -429,7 +425,6 @@ mkqid(Qid *dir, char *wname, Qid *new)
|
||||
case FsFrules:
|
||||
case FsFselcolors:
|
||||
case FsFnormcolors:
|
||||
case FsFsnap:
|
||||
case FsFkeys:
|
||||
if(dir_type != FsDdef)
|
||||
return -1;
|
||||
@ -511,10 +506,6 @@ type2stat(Stat *stat, char *wname, Qid *dir)
|
||||
}
|
||||
return mkstat(stat, dir, wname, strlen(buf), DMREAD | DMWRITE);
|
||||
break;
|
||||
case FsFsnap:
|
||||
snprintf(buf, sizeof(buf), "%d", def.snap);
|
||||
return mkstat(stat, dir, wname, strlen(buf), DMREAD | DMWRITE);
|
||||
break;
|
||||
case FsFclass:
|
||||
if(dir_type == FsDclient) {
|
||||
f = view[dir_i1]->area[dir_i2]->frame[dir_i3];
|
||||
@ -1049,11 +1040,6 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
fcall->count = strlen(buf);
|
||||
memcpy(p, buf, fcall->count);
|
||||
break;
|
||||
case FsFsnap:
|
||||
snprintf(buf, sizeof(buf), "%u", def.snap);
|
||||
fcall->count = strlen(buf);
|
||||
memcpy(p, buf, fcall->count);
|
||||
break;
|
||||
case FsFclass:
|
||||
if(m->qid.dir_type == FsDclient) {
|
||||
if((fcall->count = strlen(view[i1]->area[i2]->frame[i3]->client->classinst)))
|
||||
@ -1254,16 +1240,6 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FsFsnap:
|
||||
if(fcall->count > sizeof(buf))
|
||||
return Ebadvalue;
|
||||
memcpy(buf, fcall->data, fcall->count);
|
||||
buf[fcall->count] = 0;
|
||||
i = cext_strtonum(buf, 0, 0xffff, &err);
|
||||
if(err)
|
||||
return Ebadvalue;
|
||||
def.snap = i;
|
||||
break;
|
||||
case FsFborder:
|
||||
if(fcall->count > sizeof(buf))
|
||||
return Ebadvalue;
|
||||
|
@ -161,6 +161,8 @@ init_screen()
|
||||
rect.x = rect.y = 0;
|
||||
rect.width = DisplayWidth(dpy, screen);
|
||||
rect.height = DisplayHeight(dpy, screen);
|
||||
|
||||
def.snap = rect.height / 50;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -261,7 +263,7 @@ main(int argc, char *argv[])
|
||||
other_wm_running = 0;
|
||||
XSetErrorHandler(startup_error_handler);
|
||||
/* this causes an error if some other WM is running */
|
||||
XSelectInput(dpy, root, ROOT_MASK);
|
||||
XSelectInput(dpy, root, SubstructureRedirectMask);
|
||||
XSync(dpy, False);
|
||||
|
||||
if(other_wm_running) {
|
||||
@ -311,8 +313,7 @@ main(int argc, char *argv[])
|
||||
def.keys = nil;
|
||||
def.keyssz = 0;
|
||||
def.font = strdup(BLITZ_FONT);
|
||||
def.border = DEF_BORDER;
|
||||
def.snap = DEF_SNAP;
|
||||
def.border = 2;
|
||||
if(!strlen(def.tag))
|
||||
cext_strlcpy(def.tag, "1", sizeof(def.tag));
|
||||
cext_strlcpy(def.selcolor, BLITZ_SELCOLORS, sizeof(def.selcolor));
|
||||
@ -326,7 +327,7 @@ main(int argc, char *argv[])
|
||||
init_lock_modifiers();
|
||||
init_screen();
|
||||
|
||||
wa.event_mask = ROOT_MASK;
|
||||
wa.event_mask = SubstructureRedirectMask;
|
||||
wa.cursor = cursor[CurNormal];
|
||||
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
|
||||
|
||||
|
@ -52,7 +52,6 @@ enum {
|
||||
FsFnormcolors,
|
||||
FsFkeys,
|
||||
FsFborder,
|
||||
FsFsnap,
|
||||
FsFbar,
|
||||
FsFgeom,
|
||||
FsFevent,
|
||||
@ -67,12 +66,6 @@ enum {
|
||||
|
||||
#define MAX_TAGS 8
|
||||
#define MAX_TAGLEN 32
|
||||
|
||||
#define DEF_BORDER 2
|
||||
#define DEF_SNAP 20
|
||||
|
||||
#define ROOT_MASK SubstructureRedirectMask
|
||||
#define CLIENT_MASK (StructureNotifyMask | PropertyChangeMask)
|
||||
#define WM_PROTOCOL_DELWIN 1
|
||||
|
||||
typedef struct View View;
|
||||
|
Loading…
Reference in New Issue
Block a user