int main(int argc, char **argv) { int dev; if (argc < 2) { printf("%s device\n", argv[0]); return 1; } dev = open(argv[1], O_RDONLY); if (dev < 0) { perror("open"); return 1; } dump_dev_size(dev); puts(""); dump_bios_id(dev); puts(""); dump_media_status(dev); puts(""); dump_geom(dev, false); puts(""); dump_geom(dev, true); puts(""); dump_partition(dev); puts(""); dump_misc(dev); puts(""); return 0; }
void map_client(client_t *c) { XWindowAttributes attr; strut_t s = { 0, 0, 0, 0 }; XWMHints *hints; int btn, want_raise = 1; XGrabServer(dpy); XGetWindowAttributes(dpy, c->win, &attr); collect_struts(c, &s); if (attr.map_state == IsViewable) { c->ignore_unmap++; reparent(c, &s); if (get_wm_state(c->win) == IconicState) { c->ignore_unmap++; XUnmapWindow(dpy, c->win); } else { set_wm_state(c, NormalState); do_map(c, want_raise); } } else { if ((hints = XGetWMHints(dpy, c->win))) { if (hints->flags & StateHint) set_wm_state(c, hints->initial_state); XFree(hints); } else { set_wm_state(c, NormalState); } if (!init_geom(c, &s) && opt_imap) { btn = sweep(c, map_curs, recalc_map, SWEEP_DOWN, &s); if (btn == Button2) btn = sweep(c, resize_curs, recalc_resize, SWEEP_UP, &s); if (btn == Button3) want_raise = 0; } #ifdef DEBUG dump_geom(c, "set to"); dump_info(c); #endif reparent(c, &s); if (get_wm_state(c->win) == NormalState) do_map(c, want_raise); } XSync(dpy, False); c->name = get_wm_name(c->win); // horrible kludge XUngrabServer(dpy); }
client_t *new_client(Window w) { client_t *c; XWindowAttributes attr; XColor exact; long supplied; Atom win_type; c = malloc(sizeof *c); c->next = head; head = c; c->name = get_wm_name(w); c->win = w; c->frame = None; c->size.flags = 0; c->ignore_unmap = 0; #ifdef SHAPE c->shaped = 0; #endif c->shaded = 0; c->zoomed = 0; c->decor = 1; XGetWMNormalHints(dpy, c->win, &c->size, &supplied); XGetTransientForHint(dpy, c->win, &c->trans); XGetWindowAttributes(dpy, c->win, &attr); c->geom.x = attr.x; c->geom.y = attr.y; c->geom.w = attr.width; c->geom.h = attr.height; c->cmap = attr.colormap; c->old_bw = attr.border_width; #ifdef DEBUG dump_name(c, "creating", 'w'); dump_geom(c, "initial"); #endif XAllocNamedColor(dpy, c->cmap, opt_fg, &fg, &exact); XAllocNamedColor(dpy, c->cmap, opt_bg, &bg, &exact); XAllocNamedColor(dpy, c->cmap, opt_bd, &bd, &exact); if (get_atoms(c->win, net_wm_wintype, XA_ATOM, 0, &win_type, 1, NULL)) c->decor = HAS_DECOR(win_type); if (get_atoms(c->win, net_wm_desk, XA_CARDINAL, 0, &c->desk, 1, NULL)) { if (c->desk == -1) c->desk = DESK_ALL; /* FIXME */ if (c->desk >= ndesks && c->desk != DESK_ALL) c->desk = cur_desk; } else { set_atoms(c->win, net_wm_desk, XA_CARDINAL, &cur_desk, 1); c->desk = cur_desk; } #ifdef DEBUG dump_info(c); #endif check_states(c); /* We are not actually keeping the stack one in order. However, every * fancy panel uses it and nothing else, no matter what the spec says. * (I'm not sure why, as rearranging the list every time the stacking * changes would be distracting. GNOME's window list applet doesn't.) */ append_atoms(root, net_client_list, XA_WINDOW, &c->win, 1); append_atoms(root, net_client_stack, XA_WINDOW, &c->win, 1); return c; }