fix handling of window raisings
This commit is contained in:
parent
8fc3d6b584
commit
c22430a115
15
client.c
15
client.c
|
@ -170,7 +170,7 @@ client_ban(Client *c)
|
|||
* \param screen Screen ID
|
||||
*/
|
||||
void
|
||||
focus(Client *c, int screen)
|
||||
focus(Client *c, int screen, Bool from_mouse)
|
||||
{
|
||||
int phys_screen = get_phys_screen(screen);
|
||||
|
||||
|
@ -187,15 +187,18 @@ focus(Client *c, int screen)
|
|||
if(globalconf.focus->client)
|
||||
client_unfocus(globalconf.focus->client);
|
||||
|
||||
/* save sel in focus history */
|
||||
|
||||
if(c)
|
||||
{
|
||||
/* save sel in focus history */
|
||||
focus_add_client(c);
|
||||
XSetWindowBorder(globalconf.display, c->win,
|
||||
globalconf.screens[screen].colors_selected[ColBorder].pixel);
|
||||
XSetInputFocus(globalconf.display, c->win, RevertToPointerRoot, CurrentTime);
|
||||
restack(screen);
|
||||
if(!from_mouse
|
||||
|| !globalconf.screens[screen].sloppy_focus
|
||||
|| globalconf.screens[screen].sloppy_focus_raise)
|
||||
XRaiseWindow(globalconf.display, c->win);
|
||||
}
|
||||
else
|
||||
XSetInputFocus(globalconf.display,
|
||||
|
@ -499,7 +502,7 @@ client_unmanage(Client *c)
|
|||
untag_client(c, tag);
|
||||
|
||||
if(globalconf.focus->client == c)
|
||||
focus(NULL, c->screen);
|
||||
focus(NULL, c->screen, False);
|
||||
|
||||
XUngrabButton(globalconf.display, AnyButton, AnyModifier, c->win);
|
||||
window_setstate(c->win, WithdrawnState);
|
||||
|
@ -943,7 +946,7 @@ uicb_client_focusnext(int screen, char *arg __attribute__ ((unused)))
|
|||
if(!c)
|
||||
for(c = globalconf.clients; c && (c->skip || !client_isvisible(c, screen)); c = c->next);
|
||||
if(c)
|
||||
focus(c, screen);
|
||||
focus(c, screen, False);
|
||||
}
|
||||
|
||||
/** Send focus to previous client in stack
|
||||
|
@ -957,7 +960,7 @@ uicb_client_focusprev(int screen, char *arg __attribute__ ((unused)))
|
|||
Client *prev;
|
||||
|
||||
if((prev = client_find_prev_visible(globalconf.focus->client)))
|
||||
focus(prev, screen);
|
||||
focus(prev, screen, False);
|
||||
}
|
||||
|
||||
/** Toggle floating state of a client
|
||||
|
|
2
client.h
2
client.h
|
@ -27,7 +27,7 @@
|
|||
Bool client_isvisible(Client *, int);
|
||||
Client * get_client_bywin(Client *, Window);
|
||||
Client * get_client_byname(Client *, char *);
|
||||
void focus(Client *, int);
|
||||
void focus(Client *, int, Bool);
|
||||
void client_ban(Client *);
|
||||
void client_unban(Client *);
|
||||
void client_manage(Window, XWindowAttributes *, int);
|
||||
|
|
6
event.c
6
event.c
|
@ -117,7 +117,7 @@ handle_event_buttonpress(XEvent *e)
|
|||
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||
{
|
||||
focus(c, c->screen);
|
||||
focus(c, c->screen, False);
|
||||
if(CLEANMASK(ev->state) == NoSymbol
|
||||
&& ev->button == Button1)
|
||||
{
|
||||
|
@ -230,7 +230,7 @@ handle_event_enternotify(XEvent * e)
|
|||
{
|
||||
window_grabbuttons(get_phys_screen(c->screen), c->win, False);
|
||||
if(globalconf.screens[c->screen].sloppy_focus)
|
||||
focus(c, c->screen);
|
||||
focus(c, c->screen, True);
|
||||
}
|
||||
else
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
|
@ -297,7 +297,7 @@ handle_event_leavenotify(XEvent * e)
|
|||
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if((ev->window == RootWindow(e->xany.display, screen)) && !ev->same_screen)
|
||||
focus(NULL, screen);
|
||||
focus(NULL, screen, False);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
4
focus.c
4
focus.c
|
@ -120,7 +120,7 @@ uicb_focus_history(int screen, char *arg)
|
|||
c = focus_get_latest_client_for_tags(curtags, i);
|
||||
p_delete(&curtags);
|
||||
if(c)
|
||||
focus(c, screen);
|
||||
focus(c, screen, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ uicb_focus_client_byname(int screen, char *arg)
|
|||
if((c = get_client_byname(globalconf.clients, arg)))
|
||||
for(tag = curtags; *tag; tag++)
|
||||
if(is_client_tagged(c, *tag))
|
||||
focus(c, screen);
|
||||
focus(c, screen, False);
|
||||
p_delete(&curtags);
|
||||
}
|
||||
}
|
||||
|
|
17
layout.c
17
layout.c
|
@ -75,7 +75,7 @@ arrange(int screen)
|
|||
c->newcomer = False;
|
||||
client_unban(c);
|
||||
if(globalconf.screens[screen].new_get_focus)
|
||||
focus(c, screen);
|
||||
focus(c, screen, False);
|
||||
}
|
||||
|
||||
layout_raise_floatings(screen);
|
||||
|
@ -83,7 +83,7 @@ arrange(int screen)
|
|||
/* if we have a valid client that could be focused but currently no window
|
||||
* are focused, then set the focus on this window */
|
||||
if((c = focus_get_current_client(screen)) && !globalconf.focus->client)
|
||||
focus(c, screen);
|
||||
focus(c, screen, False);
|
||||
|
||||
/* reset status */
|
||||
globalconf.screens[screen].need_arrange = False;
|
||||
|
@ -135,19 +135,6 @@ loadawesomeprops(int screen)
|
|||
p_delete(&prop);
|
||||
}
|
||||
|
||||
void
|
||||
restack(int screen)
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
if(!globalconf.screens[screen].sloppy_focus
|
||||
|| globalconf.screens[screen].sloppy_focus_raise)
|
||||
XRaiseWindow(globalconf.display, sel->win);
|
||||
}
|
||||
|
||||
void
|
||||
saveawesomeprops(int screen)
|
||||
{
|
||||
|
|
1
layout.h
1
layout.h
|
@ -42,7 +42,6 @@ DO_SLIST(Layout, layout, p_delete);
|
|||
|
||||
int layout_refresh(void);
|
||||
Layout * get_current_layout(int);
|
||||
void restack(int);
|
||||
void loadawesomeprops(int);
|
||||
void saveawesomeprops(int);
|
||||
|
||||
|
|
4
screen.c
4
screen.c
|
@ -353,7 +353,7 @@ uicb_screen_focus(int screen, char *arg)
|
|||
if (new_screen > (globalconf.nscreen - 1))
|
||||
new_screen = 0;
|
||||
|
||||
focus(focus_get_current_client(new_screen), new_screen);
|
||||
focus(NULL, new_screen, False);
|
||||
|
||||
move_mouse_pointer_to_screen(new_screen);
|
||||
}
|
||||
|
@ -385,6 +385,6 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg)
|
|||
prev_screen = sel->screen;
|
||||
move_client_to_screen(sel, new_screen, True);
|
||||
move_mouse_pointer_to_screen(new_screen);
|
||||
focus(sel, sel->screen);
|
||||
focus(sel, sel->screen, False);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
|
@ -210,7 +210,7 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
|||
for(i = 0, tag = globalconf.screens[c->screen].tags; tag; tag = tag->next, i++)
|
||||
if(is_client_tagged(c, tag))
|
||||
tag_view_only_byindex(c->screen, i);
|
||||
focus(c, widget->statusbar->screen);
|
||||
focus(c, widget->statusbar->screen, False);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue