mirror of
https://github.com/0intro/wmii
synced 2024-12-24 04:16:50 +03:00
cleaned up things
This commit is contained in:
parent
9142b6a7ab
commit
0ed70ce953
@ -134,21 +134,16 @@ void init_client(Client * c, XWindowAttributes * wa)
|
||||
XSetWindowBorderWidth(dpy, c->win, 0);
|
||||
c->proto = win_proto(c->win);
|
||||
XGetTransientForHint(dpy, c->win, &c->trans);
|
||||
/* size hints */
|
||||
if (!XGetWMNormalHints(dpy, c->win, &c->size, &msize)
|
||||
|| !c->size.flags)
|
||||
if (!XGetWMNormalHints(dpy, c->win, &c->size, &msize) || !c->size.flags)
|
||||
c->size.flags = PSize;
|
||||
XAddToSaveSet(dpy, c->win);
|
||||
}
|
||||
|
||||
void handle_client_property(Client * c, XPropertyEvent * e)
|
||||
void handle_client_property(Client *c, XPropertyEvent *e)
|
||||
{
|
||||
XTextProperty name;
|
||||
long msize;
|
||||
|
||||
if (e->state == PropertyDelete)
|
||||
return; /* ignore */
|
||||
|
||||
if (e->atom == wm_protocols) {
|
||||
/* update */
|
||||
c->proto = win_proto(c->win);
|
||||
|
@ -196,8 +196,11 @@ static void handle_maprequest(XEvent * e)
|
||||
fprintf(stderr, "%s\n", "handle_maprequest");
|
||||
if (!XGetWindowAttributes(dpy, ev->window, &wa))
|
||||
return;
|
||||
if (wa.override_redirect)
|
||||
if (wa.override_redirect) {
|
||||
XSelectInput(dpy, ev->window, (StructureNotifyMask | PropertyChangeMask));
|
||||
return;
|
||||
}
|
||||
|
||||
/* there're client which send map requests twice */
|
||||
c = win_to_client(ev->window);
|
||||
if (!c)
|
||||
@ -225,10 +228,12 @@ static void handle_motionnotify(XEvent * e)
|
||||
static void handle_propertynotify(XEvent * e)
|
||||
{
|
||||
XPropertyEvent *ev = &e->xproperty;
|
||||
Client *c = win_to_client(ev->window);
|
||||
Client *c;
|
||||
|
||||
fprintf(stderr, "%s\n", "handle_propertynotify");
|
||||
if (c)
|
||||
if (ev->state == PropertyDelete)
|
||||
return; /* ignore */
|
||||
|
||||
if ((c = win_to_client(ev->window)))
|
||||
handle_client_property(c, ev);
|
||||
}
|
||||
|
||||
|
19
cmd/wm/wm.c
19
cmd/wm/wm.c
@ -314,7 +314,6 @@ static void draw_detached_clients()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void detached_clients(void *obj, char *cmd)
|
||||
{
|
||||
XEvent ev;
|
||||
@ -449,8 +448,11 @@ void scan_wins()
|
||||
for (i = 0; i < num; i++) {
|
||||
if (!XGetWindowAttributes(dpy, wins[i], &wa))
|
||||
continue;
|
||||
if (wa.override_redirect
|
||||
|| XGetTransientForHint(dpy, wins[i], &d1))
|
||||
if (wa.override_redirect) {
|
||||
XSelectInput(dpy, wins[i], (StructureNotifyMask | PropertyChangeMask));
|
||||
continue;
|
||||
}
|
||||
if (XGetTransientForHint(dpy, wins[i], &d1))
|
||||
continue;
|
||||
if (wa.map_state == IsViewable) {
|
||||
c = alloc_client(wins[i]);
|
||||
@ -474,6 +476,17 @@ void *get_func(void *acttbl[][2], int rows, char *fname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void update_areas_sizes(Window ignore_win)
|
||||
{
|
||||
XWindowAttributes wa;
|
||||
|
||||
fprintf(stderr, "%s", "update_areas_sizes: \n");
|
||||
if(!XGetWindowAttributes(dpy, ignore_win, &wa))
|
||||
return;
|
||||
fprintf(stderr, "update_areas_sizes: %d, %d, %d, %d\n",
|
||||
wa.x, wa.y, wa.width, wa.height);
|
||||
}
|
||||
|
||||
int win_proto(Window w)
|
||||
{
|
||||
Atom *protocols;
|
||||
|
@ -285,3 +285,4 @@ int win_state(Window w);
|
||||
void handle_after_write(IXPServer * s, File * f);
|
||||
void detach(Frame * f, int client_destroyed);
|
||||
void set_client_state(Client * c, int state);
|
||||
void update_areas_sizes(Window ignore_win);
|
||||
|
@ -31,7 +31,7 @@ int wmii_property(Display * dpy, Window w, Atom a, Atom t, long l, unsigned char
|
||||
return res;
|
||||
}
|
||||
|
||||
void wmii_send_message(Display * dpy, Window w, Atom a, long value)
|
||||
void wmii_send_message(Display *dpy, Window w, Atom a, long value)
|
||||
{
|
||||
XEvent e;
|
||||
e.type = ClientMessage;
|
||||
|
Loading…
Reference in New Issue
Block a user