[hackers] wmii: new tip (= 1779)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Thu, 08 Feb 2007 05:30:04 +0100

changeset: 1779:1d7c57eba0a7
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Wed Feb 07 23:23:18 2007 -0500
files: area.c event.c frame.c view.c wmii.h
description:
Some refactoring, mainly related to stacking of the floating layer.

diff -r 60efebfd24ce -r 1d7c57eba0a7 area.c
--- a/area.c Wed Feb 07 22:04:18 2007 -0500
+++ b/area.c Wed Feb 07 23:23:18 2007 -0500
@@ -346,8 +346,9 @@ select_area(Area *a, char *arg) {
                         if(p->anext == f) break;
                 a->sel = p;
                 arrange_column(a, False);
+ frame_to_top(p);
                 if(v == screen->sel)
- focus_view(screen, v);
+ restack_view(v);
                 flush_masked_events(EnterWindowMask);
                 return nil;
         }
@@ -357,8 +358,9 @@ select_area(Area *a, char *arg) {
                 p = f->anext ? f->anext : a->frame;
                 a->sel = p;
                 arrange_column(a, False);
+ frame_to_top(p);
                 if(v == screen->sel)
- focus_view(screen, v);
+ restack_view(v);
                 flush_masked_events(EnterWindowMask);
                 return nil;
         }
diff -r 60efebfd24ce -r 1d7c57eba0a7 event.c
--- a/event.c Wed Feb 07 22:04:18 2007 -0500
+++ b/event.c Wed Feb 07 23:23:18 2007 -0500
@@ -97,8 +97,10 @@ buttonpress(XEvent *e) {
                         break;
                         }
                 }else{
- if(ev->button == Button1)
- focus(f->client, True);
+ if(ev->button == Button1) {
+ frame_to_top(f);
+ restack_view(f->view);
+ }
                         XAllowEvents(blz.dpy, ReplayPointer, ev->time);
                 }
         }
diff -r 60efebfd24ce -r 1d7c57eba0a7 frame.c
--- a/frame.c Wed Feb 07 22:04:18 2007 -0500
+++ b/frame.c Wed Feb 07 23:23:18 2007 -0500
@@ -80,6 +80,21 @@ resize_frame(Frame *f, XRectangle *r) {
         f->rect = *r;
         if((f->area->mode != Colstack) || (f->area->sel == f))
                 match_sizehints(c, &f->rect, f->area->floating, stickycorner);
+}
+
+void
+frame_to_top(Frame *f) {
+ Frame **tf;
+ Area *a;
+
+ a = f->area;
+ if(!a->floating)
+ return;
+ for(tf=&a->frame; *tf; tf=&(*tf)->anext)
+ if(*tf == f) break;
+ *tf = f->anext;
+ f->anext = a->frame;
+ a->frame = f;
 }
 
 void
diff -r 60efebfd24ce -r 1d7c57eba0a7 view.c
--- a/view.c Wed Feb 07 22:04:18 2007 -0500
+++ b/view.c Wed Feb 07 23:23:18 2007 -0500
@@ -186,14 +186,6 @@ restack_view(View *v) {
         wins[0] = screen->barwin;
         for(a=v->area; a; a=a->next) {
                 if(a->frame) {
- if(a == v->area) {
- Frame **tf;
- for(tf=&a->frame; *tf; tf=&(*tf)->anext)
- if(*tf == a->sel) break;
- *tf = a->sel->anext;
- a->sel->anext = a->frame;
- a->frame = a->sel;
- }
                         wins[n++] = a->sel->client->framewin;
                         for(f=a->frame; f; f=f->anext) {
                                 Client *c = f->client;
diff -r 60efebfd24ce -r 1d7c57eba0a7 wmii.h
--- a/wmii.h Wed Feb 07 22:04:18 2007 -0500
+++ b/wmii.h Wed Feb 07 23:23:18 2007 -0500
@@ -319,6 +319,7 @@ extern void remove_frame(Frame *f);
 extern void remove_frame(Frame *f);
 extern void insert_frame(Frame *pos, Frame *f, Bool before);
 extern void resize_frame(Frame *f, XRectangle *r);
+extern void frame_to_top(Frame *f);
 extern void swap_frames(Frame *fa, Frame *fb);
 extern void draw_frame(Frame *f);
 extern void draw_frames();
Received on Thu Feb 08 2007 - 05:30:04 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:58 UTC