Work on tag frame

This commit is contained in:
Martin Duquesnoy 2011-09-09 17:48:35 +02:00
parent 3870db7dfc
commit 60bd64e59e
10 changed files with 54 additions and 33 deletions

View File

@ -9,6 +9,7 @@
#include "config.h" #include "config.h"
#include "util.h" #include "util.h"
#include "barwin.h" #include "barwin.h"
#include "ewmh.h"
#define CLIENT_MOUSE_MOD Mod1Mask #define CLIENT_MOUSE_MOD Mod1Mask
@ -221,8 +222,6 @@ client_new(Window w, XWindowAttributes *wa)
void void
client_remove(struct client *c) client_remove(struct client *c)
{ {
struct client *cc;
XGrabServer(W->dpy); XGrabServer(W->dpy);
XSetErrorHandler(wmfs_error_handler_dummy); XSetErrorHandler(wmfs_error_handler_dummy);
XReparentWindow(W->dpy, c->win, W->root, c->geo.x, c->geo.y); XReparentWindow(W->dpy, c->win, W->root, c->geo.x, c->geo.y);

View File

@ -19,7 +19,6 @@ config_theme(void)
struct theme *t; struct theme *t;
size_t i, n; size_t i, n;
struct conf_sec *sec, **ks; struct conf_sec *sec, **ks;
char *name;
/* [themes] */ /* [themes] */
sec = fetch_section_first(NULL, "themes"); sec = fetch_section_first(NULL, "themes");
@ -96,7 +95,7 @@ config_bars(void)
SLIST_FOREACH(s, &W->h.screen, next) SLIST_FOREACH(s, &W->h.screen, next)
if(screenid == s->id || screenid == -1) if(screenid == s->id || screenid == -1)
(struct Infobar*)infobar_new(s, t, pos, elem); infobar_new(s, t, pos, elem);
} }
free(ks); free(ks);

View File

@ -9,6 +9,7 @@
#include "wmfs.h" #include "wmfs.h"
#include "client.h" #include "client.h"
#include "barwin.h" #include "barwin.h"
#include "screen.h"
#define EVDPY(e) (e)->xany.display #define EVDPY(e) (e)->xany.display
@ -104,8 +105,6 @@ event_destroynotify(XEvent *e)
static void static void
event_focusin(XEvent *e) event_focusin(XEvent *e)
{ {
struct client *c;
if(W->client && e->xfocus.window != W->client->win) if(W->client && e->xfocus.window != W->client->win)
client_focus(W->client); client_focus(W->client);
} }
@ -246,7 +245,7 @@ event_init(void)
event_handle[DestroyNotify] = event_destroynotify; event_handle[DestroyNotify] = event_destroynotify;
event_handle[EnterNotify] = event_enternotify; event_handle[EnterNotify] = event_enternotify;
event_handle[Expose] = event_expose; event_handle[Expose] = event_expose;
/*event_handle[FocusIn] = event_focusin;*/ event_handle[FocusIn] = event_focusin;
event_handle[KeyPress] = event_keypress; event_handle[KeyPress] = event_keypress;
/*event_handle[MapNotify] = event_mapnotify;*/ /*event_handle[MapNotify] = event_mapnotify;*/
event_handle[MapRequest] = event_maprequest; event_handle[MapRequest] = event_maprequest;

View File

@ -11,7 +11,7 @@
#define MAX_EV 256 #define MAX_EV 256
#define KEYPRESS_MASK(m) (m & ~(W->numlockmask | LockMask)) #define KEYPRESS_MASK(m) (m & ~(W->numlockmask | LockMask))
#define HANDLE_EVENT(e) event_handle[(e)->type](e); #define EVENT_HANDLE(e) event_handle[(e)->type](e);
void event_init(void); void event_init(void);

View File

@ -171,8 +171,6 @@ struct infobar*
infobar_new(struct screen *s, struct theme *theme, Barpos pos, const char *elem) infobar_new(struct screen *s, struct theme *theme, Barpos pos, const char *elem)
{ {
bool map; bool map;
int n;
struct infobar *i = (struct infobar*)xcalloc(1, sizeof(struct infobar)); struct infobar *i = (struct infobar*)xcalloc(1, sizeof(struct infobar));
i->screen = s; i->screen = s;

8
wmfs2/src/layout.c Normal file
View File

@ -0,0 +1,8 @@
/*
* wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
* For license, see COPYING.
*/
#include "layout.h"

12
wmfs2/src/layout.h Normal file
View File

@ -0,0 +1,12 @@
/*
* wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
* For license, see COPYING.
*/
#ifndef LAYOUT_H
#define LAYOUT_H
#include "wmfs.h"
#endif /* LAYOUT_H */

View File

@ -37,7 +37,6 @@ screen_new(struct geo *g, int id)
void void
screen_init(void) screen_init(void)
{ {
struct screen *s;
struct geo g; struct geo g;
SLIST_INIT(&W->h.screen); SLIST_INIT(&W->h.screen);
@ -57,7 +56,7 @@ screen_init(void)
g.w = xsi[i].width; g.w = xsi[i].width;
g.h = xsi[i].height; g.h = xsi[i].height;
s = screen_new(&g, i); screen_new(&g, i);
} }
XFree(xsi); XFree(xsi);
@ -69,7 +68,7 @@ screen_init(void)
g.w = DisplayWidth(W->dpy, W->xscreen); g.w = DisplayWidth(W->dpy, W->xscreen);
g.h = DisplayHeight(W->dpy, W->xscreen); g.h = DisplayHeight(W->dpy, W->xscreen);
s = screen_new(&g, 0); screen_new(&g, 0);
} }
} }
@ -92,9 +91,11 @@ screen_update_sel(void)
if(INAREA(x, y, s->geo)) if(INAREA(x, y, s->geo))
break; break;
W->screen = s; return (W->screen = s);
} }
#endif /* HAVE_XINERAMA */ #endif /* HAVE_XINERAMA */
return W->screen;
} }
void void

View File

@ -11,6 +11,7 @@
#include "client.h" #include "client.h"
#include "config.h" #include "config.h"
#include "barwin.h" #include "barwin.h"
#include "ewmh.h"
struct tag* struct tag*
tag_new(struct screen *s, char *name) tag_new(struct screen *s, char *name)
@ -32,15 +33,15 @@ tag_new(struct screen *s, char *name)
t->sel = NULL; t->sel = NULL;
/* Frame window */ /* Frame window */
t->frame = XCreateWindow(W->dpy, W->root, t->frame = XCreateWindow(W->dpy, W->root,
s->ugeo.x, s->ugeo.y, s->ugeo.x, s->ugeo.y,
s->ugeo.w, s->ugeo.h, s->ugeo.w, s->ugeo.h,
0, CopyFromParent, 0, CopyFromParent,
InputOutput, InputOutput,
CopyFromParent, CopyFromParent,
(CWOverrideRedirect | CWBackPixmap (CWOverrideRedirect | CWBackPixmap
| CWBackPixel | CWEventMask), | CWBackPixel | CWEventMask),
&at); &at);
SLIST_INIT(&t->clients); SLIST_INIT(&t->clients);
@ -94,7 +95,10 @@ tag_client(struct tag *t, struct client *c)
c->tag->sel = NULL; c->tag->sel = NULL;
} }
/* Case of client remove */ /*
* Case of client removing: umap frame if empty
* TODO: arrange layout
*/
if(!t) if(!t)
{ {
/* Unmap frame if tag is now empty */ /* Unmap frame if tag is now empty */
@ -113,6 +117,8 @@ tag_client(struct tag *t, struct client *c)
/* Reparent client win in frame win */ /* Reparent client win in frame win */
XReparentWindow(W->dpy, c->win, t->frame, 0, 0); XReparentWindow(W->dpy, c->win, t->frame, 0, 0);
/* tag_frame_client */
/* Insert in new tag list */ /* Insert in new tag list */
SLIST_INSERT_HEAD(&t->clients, c, tnext); SLIST_INSERT_HEAD(&t->clients, c, tnext);
} }

View File

@ -101,9 +101,13 @@ wmfs_init_font(char *font, struct theme *t)
static void static void
wmfs_xinit(void) wmfs_xinit(void)
{ {
int i, j; XSetWindowAttributes at =
XModifierKeymap *mm; {
XSetWindowAttributes at; .event_mask = (KeyMask | ButtonMask | MouseMask
| PropertyChangeMask | SubstructureRedirectMask
| SubstructureNotifyMask | StructureNotifyMask),
.cursor = XCreateFontCursor(W->dpy, XC_left_ptr)
};
/* /*
* X Error handler * X Error handler
@ -121,11 +125,6 @@ wmfs_xinit(void)
* Root window/cursor * Root window/cursor
*/ */
W->root = RootWindow(W->dpy, W->xscreen); W->root = RootWindow(W->dpy, W->xscreen);
at.event_mask = KeyMask | ButtonMask | MouseMask | PropertyChangeMask
| SubstructureRedirectMask | SubstructureNotifyMask | StructureNotifyMask;
at.cursor = XCreateFontCursor(W->dpy, XC_left_ptr);
XChangeWindowAttributes(W->dpy, W->root, CWEventMask | CWCursor, &at); XChangeWindowAttributes(W->dpy, W->root, CWEventMask | CWCursor, &at);
/* /*
@ -236,7 +235,7 @@ wmfs_loop(void)
while(XPending(W->dpy)) while(XPending(W->dpy))
while(W->running && !XNextEvent(W->dpy, &ev)) while(W->running && !XNextEvent(W->dpy, &ev))
HANDLE_EVENT(&ev); EVENT_HANDLE(&ev);
} }
static inline void static inline void