Explorar o código

Work on tag frame

Martin Duquesnoy %!s(int64=12) %!d(string=hai) anos
pai
achega
60bd64e59e
Modificáronse 10 ficheiros con 54 adicións e 33 borrados
  1. 1 2
      wmfs2/src/client.c
  2. 1 2
      wmfs2/src/config.c
  3. 2 3
      wmfs2/src/event.c
  4. 1 1
      wmfs2/src/event.h
  5. 0 2
      wmfs2/src/infobar.c
  6. 8 0
      wmfs2/src/layout.c
  7. 12 0
      wmfs2/src/layout.h
  8. 5 4
      wmfs2/src/screen.c
  9. 16 10
      wmfs2/src/tag.c
  10. 8 9
      wmfs2/src/wmfs.c

+ 1 - 2
wmfs2/src/client.c

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

+ 1 - 2
wmfs2/src/config.c

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

+ 2 - 3
wmfs2/src/event.c

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

+ 1 - 1
wmfs2/src/event.h

@@ -11,7 +11,7 @@
 #define MAX_EV 256
 
 #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);
 

+ 0 - 2
wmfs2/src/infobar.c

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

+ 8 - 0
wmfs2/src/layout.c

@@ -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 - 0
wmfs2/src/layout.h

@@ -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 */
+

+ 5 - 4
wmfs2/src/screen.c

@@ -37,7 +37,6 @@ screen_new(struct geo *g, int id)
 void
 screen_init(void)
 {
-     struct screen *s;
      struct geo g;
 
      SLIST_INIT(&W->h.screen);
@@ -57,7 +56,7 @@ screen_init(void)
                g.w = xsi[i].width;
                g.h = xsi[i].height;
 
-               s = screen_new(&g, i);
+               screen_new(&g, i);
           }
 
           XFree(xsi);
@@ -69,7 +68,7 @@ screen_init(void)
           g.w = DisplayWidth(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))
                     break;
 
-          W->screen = s;
+          return (W->screen = s);
      }
 #endif /* HAVE_XINERAMA */
+
+     return W->screen;
 }
 
 void

+ 16 - 10
wmfs2/src/tag.c

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

+ 8 - 9
wmfs2/src/wmfs.c

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