Bug fixes.

This commit is contained in:
Kris Maglione 2008-01-21 16:18:17 -05:00
parent 9d5f2c8014
commit 7b1c1664f9
9 changed files with 290 additions and 36 deletions

View File

@ -20,7 +20,8 @@ area_idx(Area *a) {
uint i;
v = a->view;
for(i = 0, ap = v->area; a != ap; ap = ap->next)
i = 0;
for(ap=v->area; a != ap; ap=ap->next)
i++;
return i;
}

View File

@ -35,13 +35,13 @@ column_new(View *v, Area *pos, uint w) {
Area *a;
a = area_create(v, pos, w);
return a;
if(!a)
return nil;
view_arrange(v);
if(v == screen->sel)
view_focus(screen, v);
return a;
}
void
@ -51,6 +51,8 @@ column_insert(Area *a, Frame *f, Frame *pos) {
f->client->floating = false;
f->column = area_idx(a);
frame_insert(f, pos);
if(a->sel == nil)
area_setsel(a, f);
}
void
@ -67,13 +69,11 @@ column_attach(Area *a, Frame *f) {
f->r.max.y = Dy(a->r) / nframe;
column_insert(a, f, a->sel);
if(a->sel == nil)
area_setsel(a, f);
column_arrange(a, false);
}
void
column_remove(Frame *f, bool arrange) {
column_remove(Frame *f) {
Client *c;
Frame *pr;
Area *a;
@ -94,23 +94,15 @@ column_remove(Frame *f, bool arrange) {
a->sel = nil;
area_setsel(a, pr);
}
if(a->frame) {
if(arrange)
column_arrange(a, False);
}
else {
if(v->area->next->next)
area_destroy(a);
else if(v->area->frame)
area_focus(v->area);
}
}
void
column_detach(Frame *f) {
Area *a;
column_remove(f, true);
a = f->area;
column_remove(f);
column_arrange(a, false);
}
static void
@ -240,10 +232,17 @@ column_scale(Area *a) {
void
column_arrange(Area *a, bool dirty) {
Frame *f;
View *v;
if(a->floating || !a->frame)
return;
v = a->view;
if(!a->frame) {
view_arrange(v);
return;
}
switch(a->mode) {
case Coldefault:
if(dirty)
@ -266,8 +265,8 @@ column_arrange(Area *a, bool dirty) {
}
column_scale(a);
resize:
if(a->view == screen->sel) {
view_restack(a->view);
if(v == screen->sel) {
view_restack(v);
client_resize(a->sel->client, a->sel->r);
for(f=a->frame; f; f=f->anext)

View File

@ -4,7 +4,6 @@
#include "dat.h"
#include <X11/keysym.h>
#include "fns.h"
#include "printevent.h"
void
dispatch_event(XEvent *e) {

View File

@ -66,7 +66,7 @@ void column_attach(Area*, Frame*);
void column_detach(Frame*);
void column_insert(Area*, Frame*, Frame*);
Area* column_new(View*, Area *, uint);
void column_remove(Frame*, bool);
void column_remove(Frame*);
void column_resize(Area*, int);
void column_resizeframe(Frame*, Rectangle*);
void div_draw(Divide*);
@ -180,6 +180,9 @@ void mouse_resizecol(Divide*);
void grab_button(XWindow, uint button, ulong mod);
Align snap_rect(Rectangle *rects, int num, Rectangle *current, Align *mask, int snapw);
/* printevent.c */
void printevent(XEvent*);
/* rule.c */
void trim(char *str, const char *chars);
void update_rules(Rule**, const char*);

View File

@ -278,7 +278,7 @@ horiz:
/* TODO: Fix... Tangled, broken mess. */
fprev = f->aprev;
fnext = f->anext;
column_remove(f, false);
column_remove(f);
if(fnext
&& (!fprev || (fw->fprev != fprev)
&& (fw->fprev != fprev->aprev))) {

View File

@ -44,9 +44,7 @@
#include <bio.h>
//#include "fns.h"
#include "printevent.h"
#include <X11/Xproto.h>
#define Window XWindow
#include <X11/Intrinsic.h>
#define nil ((void*)0)
@ -406,15 +404,15 @@ TPlace(Biobuf *b, va_list *ap) {
/* Returns the string equivalent of a major code */
static void
TMajor(Biobuf *b, va_list *ap) {
static Pair list[] = {
{X_CopyArea, "X_CopyArea"},
{X_CopyPlane, "X_CopyPlane"},
{0, nil},
};
int key;
static char *list[] = { XMajors };
char *s;
uint key;
key = va_arg(*ap, int);
Bprint(b, "%s", search(list, key, strhex));
key = va_arg(*ap, uint);
s = "<nil>";
if(key < nelem(list))
s = list[key];
Bprint(b, "%s", s);
}
static char*

View File

@ -1 +1,248 @@
void printevent(XEvent*);
enum {
X_CreateWindow = 1,
X_ChangeWindowAttributes,
X_GetWindowAttributes,
X_DestroyWindow,
X_DestroySubwindows,
X_ChangeSaveSet,
X_ReparentWindow,
X_MapWindow,
X_MapSubwindows,
X_UnmapWindow,
X_UnmapSubwindows,
X_ConfigureWindow,
X_CirculateWindow,
X_GetGeometry,
X_QueryTree,
X_InternAtom,
X_GetAtomName,
X_ChangeProperty,
X_DeleteProperty,
X_GetProperty,
X_ListProperties,
X_SetSelectionOwner,
X_GetSelectionOwner,
X_ConvertSelection,
X_SendEvent,
X_GrabPointer,
X_UngrabPointer,
X_GrabButton,
X_UngrabButton,
X_ChangeActivePointerGrab,
X_GrabKeyboard,
X_UngrabKeyboard,
X_GrabKey,
X_UngrabKey,
X_AllowEvents,
X_GrabServer,
X_UngrabServer,
X_QueryPointer,
X_GetMotionEvents,
X_TranslateCoords,
X_WarpPointer,
X_SetInputFocus,
X_GetInputFocus,
X_QueryKeymap,
X_OpenFont,
X_CloseFont,
X_QueryFont,
X_QueryTextExtents,
X_ListFonts,
X_ListFontsWithInfo,
X_SetFontPath,
X_GetFontPath,
X_CreatePixmap,
X_FreePixmap,
X_CreateGC,
X_ChangeGC,
X_CopyGC,
X_SetDashes,
X_SetClipRectangles,
X_FreeGC,
X_ClearArea,
X_CopyArea,
X_CopyPlane,
X_PolyPoint,
X_PolyLine,
X_PolySegment,
X_PolyRectangle,
X_PolyArc,
X_FillPoly,
X_PolyFillRectangle,
X_PolyFillArc,
X_PutImage,
X_GetImage,
X_PolyText8,
X_PolyText16,
X_ImageText8,
X_ImageText16,
X_CreateColormap,
X_FreeColormap,
X_CopyColormapAndFree,
X_InstallColormap,
X_UninstallColormap,
X_ListInstalledColormaps,
X_AllocColor,
X_AllocNamedColor,
X_AllocColorCells,
X_AllocColorPlanes,
X_FreeColors,
X_StoreColors,
X_StoreNamedColor,
X_QueryColors,
X_LookupColor,
X_CreateCursor,
X_CreateGlyphCursor,
X_FreeCursor,
X_RecolorCursor,
X_QueryBestSize,
X_QueryExtension,
X_ListExtensions,
X_ChangeKeyboardMapping,
X_GetKeyboardMapping,
X_ChangeKeyboardControl,
X_GetKeyboardControl,
X_Bell,
X_ChangePointerControl,
X_GetPointerControl,
X_SetScreenSaver,
X_GetScreenSaver,
X_ChangeHosts,
X_ListHosts,
X_SetAccessControl,
X_SetCloseDownMode,
X_KillClient,
X_RotateProperties,
X_ForceScreenSaver,
X_SetPointerMapping,
X_GetPointerMapping,
X_SetModifierMapping,
X_GetModifierMapping,
X_NoOperation,
};
#define XMajors \
"<nil>",\
"CreateWindow",\
"ChangeWindowAttributes",\
"GetWindowAttributes",\
"DestroyWindow",\
"DestroySubwindows",\
"ChangeSaveSet",\
"ReparentWindow",\
"MapWindow",\
"MapSubwindows",\
"UnmapWindow",\
"UnmapSubwindows",\
"ConfigureWindow",\
"CirculateWindow",\
"GetGeometry",\
"QueryTree",\
"InternAtom",\
"GetAtomName",\
"ChangeProperty",\
"DeleteProperty",\
"GetProperty",\
"ListProperties",\
"SetSelectionOwner",\
"GetSelectionOwner",\
"ConvertSelection",\
"SendEvent",\
"GrabPointer",\
"UngrabPointer",\
"GrabButton",\
"UngrabButton",\
"ChangeActivePointerGrab",\
"GrabKeyboard",\
"UngrabKeyboard",\
"GrabKey",\
"UngrabKey",\
"AllowEvents",\
"GrabServer",\
"UngrabServer",\
"QueryPointer",\
"GetMotionEvents",\
"TranslateCoords",\
"WarpPointer",\
"SetInputFocus",\
"GetInputFocus",\
"QueryKeymap",\
"OpenFont",\
"CloseFont",\
"QueryFont",\
"QueryTextExtents",\
"ListFonts",\
"ListFontsWithInfo",\
"SetFontPath",\
"GetFontPath",\
"CreatePixmap",\
"FreePixmap",\
"CreateGC",\
"ChangeGC",\
"CopyGC",\
"SetDashes",\
"SetClipRectangles",\
"FreeGC",\
"ClearArea",\
"CopyArea",\
"CopyPlane",\
"PolyPoint",\
"PolyLine",\
"PolySegment",\
"PolyRectangle",\
"PolyArc",\
"FillPoly",\
"PolyFillRectangle",\
"PolyFillArc",\
"PutImage",\
"GetImage",\
"PolyText8",\
"PolyText16",\
"ImageText8",\
"ImageText16",\
"CreateColormap",\
"FreeColormap",\
"CopyColormapAndFree",\
"InstallColormap",\
"UninstallColormap",\
"ListInstalledColormaps",\
"AllocColor",\
"AllocNamedColor",\
"AllocColorCells",\
"AllocColorPlanes",\
"FreeColors",\
"StoreColors",\
"StoreNamedColor",\
"QueryColors",\
"LookupColor",\
"CreateCursor",\
"CreateGlyphCursor",\
"FreeCursor",\
"RecolorCursor",\
"QueryBestSize",\
"QueryExtension",\
"ListExtensions",\
"ChangeKeyboardMapping",\
"GetKeyboardMapping",\
"ChangeKeyboardControl",\
"GetKeyboardControl",\
"Bell",\
"ChangePointerControl",\
"GetPointerControl",\
"SetScreenSaver",\
"GetScreenSaver",\
"ChangeHosts",\
"ListHosts",\
"SetAccessControl",\
"SetCloseDownMode",\
"KillClient",\
"RotateProperties",\
"ForceScreenSaver",\
"SetPointerMapping",\
"GetPointerMapping",\
"SetModifierMapping",\
"GetModifierMapping",\
"NoOperation",\

View File

@ -124,7 +124,7 @@ update_frame_selectors(View *v) {
void
view_focus(WMScreen *s, View *v) {
Client *c;
Frame *f;
Frame *f, *fnext;
Area *a;
bool fscrn;
@ -137,7 +137,8 @@ view_focus(WMScreen *s, View *v) {
div_update_all();
fscrn = false;
for(a=v->area; a; a=a->next)
for(f=a->frame; f; f=f->anext)
for(f=a->frame; f; f=fnext) {
fnext = f->anext;
if(f->client->fullscreen) {
f->collapsed = false;
fscrn = true;
@ -151,6 +152,7 @@ view_focus(WMScreen *s, View *v) {
f->oldarea = 0;
}
}
}
for(c=client; c; c=c->next)
if((f = c->sel)) {
if(f->view == v)
@ -302,13 +304,18 @@ view_scale(View *v, int w) {
void
view_arrange(View *v) {
uint xoff;
Area *a;
Area *a, *anext;
if(!v->area->next)
return;
view_scale(v, Dx(v->r));
xoff = 0;
for(a=v->area->next; a; a=anext) {
anext = a->next;
if(!a->frame && v->area->next->next)
area_destroy(a);
}
for(a=v->area->next; a; a=a->next) {
a->r.min.x = xoff;
a->r.min.y = 0;

View File

@ -14,7 +14,7 @@ LIBS = -L/usr/lib -lc -L$(ROOT)/lib
# Flags
include $(ROOT)/mk/gcc.mk
CFLAGS += $(DEBUGCFLAGS)
CFLAGS += $(DEBUGCFLAGS) -O0
LDFLAGS += -g $(LIBS)
SOLDFLAGS += $(LDFLAGS)
STATIC = -static