XGrabServer(dsply);
XSetErrorHandler(ignore_xerror);
-#ifdef DEBUG
- err("removing %s, %d: %d left", c->name, mode, XPending(dsply));
-#endif
-
if (mode == WITHDRAW)
{
set_wm_state(c, WithdrawnState);
{
XFree(c->size);
}
- if (c == fullscreen_client)
- {
- fullscreen_client = NULL;
- }
if (c == focused_client)
{
focused_client = NULL;
void redraw(Client *c)
{
- if (c == fullscreen_client)
- {
- return;
- }
XDrawLine(dsply, c->frame, border_gc, 0, BARHEIGHT() - DEF_BORDERWIDTH + DEF_BORDERWIDTH / 2, c->width, BARHEIGHT() - DEF_BORDERWIDTH + DEF_BORDERWIDTH / 2);
// clear text part of bar
if (c == focused_client)
for (;;)
{
interruptible_XNextEvent(&ev);
-#ifdef DEBUG
- show_event(ev);
-#endif
switch (ev.type)
{
case ButtonPress:
if (e->state & MODIFIER)
{
- if (focused_client != NULL && focused_client != fullscreen_client)
- {
+ if (focused_client != NULL)
resize(focused_client, e->x_root, e->y_root);
- }
- else
- {
- // pass event on
+ else // pass event on
XAllowEvents(dsply, ReplayPointer, CurrentTime);
- }
}
else
{
// pass event on
XAllowEvents(dsply, ReplayPointer, CurrentTime);
- if (e->button == Button1)
- {
+ if (e->button == Button1) {
c = find_client(e->window, FRAME);
if (c != NULL)
{
// click-to-focus
check_focus(c);
- if (e->y < BARHEIGHT() && c != fullscreen_client)
+ if (e->y < BARHEIGHT())
{
handle_windowbar_click(e, c);
}
static void draw_button(Client *c, GC *detail_gc, GC *background_gc, unsigned int which_box)
{
- if (which_box == 0) {
+ if (which_box == 0)
draw_close_button(c, detail_gc, background_gc);
- }
}
/* Because we are redirecting the root window, we get ConfigureRequest
Client *c = find_client(e->window, WINDOW);
XWindowChanges wc;
- if (fullscreen_client != NULL && c == fullscreen_client)
- {
- if (e->value_mask & CWX)
- {
- fs_prevdims.x = e->x;
- }
- if (e->value_mask & CWY)
- {
- fs_prevdims.y = e->y;
- }
- if (e->value_mask & CWWidth)
- {
- fs_prevdims.width = e->width;
- }
- if (e->value_mask & CWHeight)
- {
- fs_prevdims.height = e->height;
- }
- return;
- }
-
if (c != NULL)
{
gravitate(c, REMOVE_GRAVITY);
XColor border_col, text_col, active_col, depressed_col, inactive_col, selected_col, empty_col;
Cursor resize_curs;
Atom wm_state, wm_change_state, wm_protos, wm_delete, wm_cmapwins;
-Client *head_client = NULL, *focused_client = NULL, *topmost_client = NULL, *fullscreen_client = NULL;
+Client *head_client = NULL, *focused_client = NULL, *topmost_client = NULL;
unsigned int focus_count = 0;
Rect fs_prevdims;
char *opt_font = DEF_FONT;
if (modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dsply, XK_Num_Lock))
{
numlockmask = (1 << i);
-#ifdef DEBUG
- fprintf(stderr, "setup_display() : XK_Num_Lock is (1<<0x%02x)\n", i);
-#endif
}
}
}
bounddims.height += c->height - ((BARHEIGHT() * 2) - DEF_BORDERWIDTH);
constraint_win = XCreateWindow(dsply, root, bounddims.x, bounddims.y, bounddims.width, bounddims.height, 0, CopyFromParent, InputOnly, CopyFromParent, 0, &pattr);
-#ifdef DEBUG
- fprintf(stderr, "move() : constraint_win is (%d, %d)-(%d, %d)\n", bounddims.x, bounddims.y, bounddims.x + bounddims.width, bounddims.y + bounddims.height);
-#endif
XMapWindow(dsply, constraint_win);
if (!(XGrabPointer(dsply, root, False, MouseMask, GrabModeAsync, GrabModeAsync, constraint_win, None, CurrentTime) == GrabSuccess))
int ymax = DisplayHeight(dsply, screen);
int titlebarheight;
-#ifdef DEBUG
- fprintf(stderr, "fix_position(): client was (%d, %d)-(%d, %d)\n", c->x, c->y, c->x + c->width, c->y + c->height);
-#endif
-
- titlebarheight = (fullscreen_client == c) ? 0 : BARHEIGHT();
+ titlebarheight = BARHEIGHT();
if (c->width < MINWINWIDTH)
{
c->y = (ymax - c->height) - BARHEIGHT();
}
-#ifdef DEBUG
- fprintf(stderr, "fix_position(): client is (%d, %d)-(%d, %d)\n", c->x, c->y, c->x + c->width, c->y + c->height);
-#endif
-
c->x -= BORDERWIDTH(c);
c->y -= BORDERWIDTH(c);
}
destdims->height = sourcedims->height;
}
-#ifdef DEBUG
-
-/* Bleh, stupid macro names. I'm not feeling creative today. */
-
-#define SHOW_EV(name, memb) \
- case name: \
- s = #name; \
- w = e.memb.window; \
- break;
-#define SHOW(name) \
- case name: \
- return #name;
-
-void show_event(XEvent e)
-{
- char *s, buf[20];
- Window w;
- Client *c;
-
- switch (e.type)
- {
- SHOW_EV(ButtonPress, xbutton)
- SHOW_EV(ButtonRelease, xbutton)
- SHOW_EV(ClientMessage, xclient)
- SHOW_EV(ColormapNotify, xcolormap)
- SHOW_EV(ConfigureNotify, xconfigure)
- SHOW_EV(ConfigureRequest, xconfigurerequest)
- SHOW_EV(CreateNotify, xcreatewindow)
- SHOW_EV(DestroyNotify, xdestroywindow)
- SHOW_EV(EnterNotify, xcrossing)
- SHOW_EV(Expose, xexpose)
- SHOW_EV(MapNotify, xmap)
- SHOW_EV(MapRequest, xmaprequest)
- SHOW_EV(MappingNotify, xmapping)
- SHOW_EV(MotionNotify, xmotion)
- SHOW_EV(PropertyNotify, xproperty)
- SHOW_EV(ReparentNotify, xreparent)
- SHOW_EV(ResizeRequest, xresizerequest)
- SHOW_EV(UnmapNotify, xunmap)
- default:
- if (shape && e.type == shape_event)
- {
- s = "ShapeNotify";
- w = ((XShapeEvent *)&e)->window;
- }
- else
- {
- s = "unknown event";
- w = None;
- }
- break;
- }
-
- c = find_client(w, WINDOW);
- snprintf(buf, sizeof buf, c != NULL ? c->name : "(none)");
- err("%#-10lx: %-20s: %s", w, buf, s);
-}
-
-static const char *show_state(Client *c)
-{
- switch (get_wm_state(c))
- {
- SHOW(WithdrawnState)
- SHOW(NormalState)
- SHOW(IconicState)
- default: return "unknown state";
- }
-}
-
-static const char *show_grav(Client *c)
-{
- if (c->size == NULL || !(c->size->flags & PWinGravity))
- {
- return "no grav (NW)";
- }
-
- switch (c->size->win_gravity)
- {
- SHOW(UnmapGravity)
- SHOW(NorthWestGravity)
- SHOW(NorthGravity)
- SHOW(NorthEastGravity)
- SHOW(WestGravity)
- SHOW(CenterGravity)
- SHOW(EastGravity)
- SHOW(SouthWestGravity)
- SHOW(SouthGravity)
- SHOW(SouthEastGravity)
- SHOW(StaticGravity)
- default: return "unknown grav";
- }
-}
-
-void dump(Client *c)
-{
- if (c != NULL)
- {
- err("%s\n\t%s, %s, ignore %d, was_hidden %d\n\tframe %#lx, win %#lx, geom %dx%d+%d+%d", c->name, show_state(c), show_grav(c), c->ignore_unmap, c->was_hidden, c->frame, c->window, c->width, c->height, c->x, c->y);
- }
-}
-
-void dump_clients(void)
-{
- Client *c = head_client;
- while (c != NULL)
- {
- dump(c);
- c = c->next;
- }
-}
-#endif
-
/* We use XQueryTree here to preserve the window stacking order,
* since the order in our linked list is different. */
extern void fix_position(Client *);
extern void refix_position(Client *, XConfigureRequestEvent *);
extern void copy_dims(Rect *, Rect *);
-#ifdef DEBUG
-extern void show_event(XEvent);
-extern void dump(Client *);
-extern void dump_clients(void);
-#endif
#endif /* WINDOWLAB_H */