mirror of
https://github.com/0intro/wmii
synced 2024-11-25 23:30:24 +03:00
fixed page focussing issues
This commit is contained in:
parent
9dd3945664
commit
76a41dbdab
@ -310,8 +310,10 @@ attach_client(Client * c)
|
||||
Layout *l = 0;
|
||||
Page *p = selpage;
|
||||
|
||||
if(!p)
|
||||
if(!p) {
|
||||
p = alloc_page();
|
||||
focus_page(p);
|
||||
}
|
||||
/* transient stuff */
|
||||
l = p->sel;
|
||||
if(c && c->trans) {
|
||||
|
@ -276,21 +276,10 @@ static void handle_clientmessage(XEvent *e)
|
||||
{
|
||||
XClientMessageEvent *ev = &e->xclient;
|
||||
|
||||
if (ev->message_type == net_atoms[NET_NUMBER_OF_DESKTOPS] && ev->format == 32) {
|
||||
if (ev->message_type == net_atoms[NET_NUMBER_OF_DESKTOPS] && ev->format == 32)
|
||||
return; /* ignore */
|
||||
}
|
||||
else if (ev->message_type == net_atoms[NET_CURRENT_DESKTOP] && ev->format == 32) {
|
||||
int i;
|
||||
Page *p;
|
||||
i = ev->data.l[0];
|
||||
|
||||
for (p = pages; p; p = p->next) {
|
||||
if (p->index == i) {
|
||||
focus_page(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
focus_page(pageat(ev->data.l[0]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ alloc_page()
|
||||
p->next = new;
|
||||
new->index = p->index + 1;
|
||||
}
|
||||
selpage = new;
|
||||
def[WM_SEL_PAGE]->content = new->file[P_PREFIX]->content;
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
npages++;
|
||||
@ -119,33 +118,30 @@ destroy_page(Page * p)
|
||||
selpage = pages;
|
||||
npages--;
|
||||
XChangeProperty(dpy, root, net_atoms[NET_NUMBER_OF_DESKTOPS], XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &npages, 1);
|
||||
|
||||
if(selpage)
|
||||
focus_page(selpage);
|
||||
}
|
||||
|
||||
void
|
||||
focus_page(Page * p)
|
||||
{
|
||||
if(p && (p != selpage)) {
|
||||
if(selpage) {
|
||||
unmap_layout(selpage->managed);
|
||||
unmap_layout(selpage->floating);
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
selpage = p;
|
||||
map_layout(p->managed, False);
|
||||
map_layout(p->floating, False);
|
||||
def[WM_SEL_PAGE]->content = p->file[P_PREFIX]->content;
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
focus_layout(sel_layout());
|
||||
focus_layout(p->sel);
|
||||
XChangeProperty(dpy, root, net_atoms[NET_CURRENT_DESKTOP], XA_CARDINAL,
|
||||
32, PropModeReplace, (unsigned char *) &(selpage->index), 1);
|
||||
}
|
||||
|
||||
void
|
||||
unfocus_page(Page * p)
|
||||
{
|
||||
selpage = nil;
|
||||
def[WM_SEL_PAGE]->content = nil;
|
||||
unmap_layout(p->managed);
|
||||
unmap_layout(p->floating);
|
||||
}
|
||||
|
||||
XRectangle *
|
||||
rectangles(unsigned int *num)
|
||||
{
|
||||
|
18
cmd/wm/wm.c
18
cmd/wm/wm.c
@ -281,18 +281,15 @@ pager(void *obj, char *arg)
|
||||
XUnmapWindow(dpy, transient);
|
||||
if((i = handle_kpress(&ev.xkey)) != -1)
|
||||
if(i < npages)
|
||||
focus_page(pageat(i));
|
||||
focus_page(pageat(i));
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XUngrabPointer(dpy, CurrentTime /* ev.xbutton.time */ );
|
||||
return;
|
||||
break;
|
||||
case ButtonPress:
|
||||
XUnmapWindow(dpy, transient);
|
||||
if(ev.xbutton.button == Button1) {
|
||||
Page *p = xy_to_pager_page(ev.xbutton.x, ev.xbutton.y);
|
||||
if(p)
|
||||
focus_page(p);
|
||||
}
|
||||
if(ev.xbutton.button == Button1)
|
||||
focus_page(xy_to_pager_page(ev.xbutton.x, ev.xbutton.y));
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XUngrabPointer(dpy, CurrentTime /* ev.xbutton.time */ );
|
||||
return;
|
||||
@ -443,16 +440,13 @@ _select_page(void *obj, char *arg)
|
||||
p = pages;
|
||||
} else
|
||||
p = pageat(blitz_strtonum(arg, 0, npages - 1));
|
||||
if(p)
|
||||
focus_page(p);
|
||||
focus_page(p);
|
||||
}
|
||||
|
||||
static void
|
||||
_destroy_page(void *obj, char *arg)
|
||||
{
|
||||
Page *p = selpage;
|
||||
if(p)
|
||||
destroy_page(p);
|
||||
destroy_page(selpage);
|
||||
if(selpage)
|
||||
focus_page(selpage);
|
||||
}
|
||||
@ -460,8 +454,6 @@ _destroy_page(void *obj, char *arg)
|
||||
static void
|
||||
new_page(void *obj, char *arg)
|
||||
{
|
||||
if(selpage)
|
||||
unfocus_page(selpage);
|
||||
focus_page(alloc_page());
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,6 @@ Page *pageat(unsigned int idx);
|
||||
Page *alloc_page();
|
||||
void destroy_page(Page * p);
|
||||
void focus_page(Page * p);
|
||||
void unfocus_page(Page * p);
|
||||
XRectangle *rectangles(unsigned int *num);
|
||||
|
||||
/* layout.c */
|
||||
|
Loading…
Reference in New Issue
Block a user