@ -517,7 +517,8 @@ clientmessage(XEvent *e)
if ( ! c )
if ( ! c )
return ;
return ;
if ( cme - > message_type = = netatom [ NetWMState ] ) {
if ( cme - > message_type = = netatom [ NetWMState ] ) {
if ( cme - > data . l [ 1 ] = = netatom [ NetWMFullscreen ] | | cme - > data . l [ 2 ] = = netatom [ NetWMFullscreen ] )
if ( cme - > data . l [ 1 ] = = netatom [ NetWMFullscreen ]
| | cme - > data . l [ 2 ] = = netatom [ NetWMFullscreen ] )
setfullscreen ( c , ( cme - > data . l [ 0 ] = = 1 /* _NET_WM_STATE_ADD */
setfullscreen ( c , ( cme - > data . l [ 0 ] = = 1 /* _NET_WM_STATE_ADD */
| | ( cme - > data . l [ 0 ] = = 2 /* _NET_WM_STATE_TOGGLE */ & & ! c - > isfullscreen ) ) ) ;
| | ( cme - > data . l [ 0 ] = = 2 /* _NET_WM_STATE_TOGGLE */ & & ! c - > isfullscreen ) ) ) ;
} else if ( cme - > message_type = = netatom [ NetActiveWindow ] ) {
} else if ( cme - > message_type = = netatom [ NetActiveWindow ] ) {
@ -783,7 +784,6 @@ focus(Client *c)
{
{
if ( ! c | | ! ISVISIBLE ( c ) )
if ( ! c | | ! ISVISIBLE ( c ) )
for ( c = selmon - > stack ; c & & ! ISVISIBLE ( c ) ; c = c - > snext ) ;
for ( c = selmon - > stack ; c & & ! ISVISIBLE ( c ) ; c = c - > snext ) ;
/* was if (selmon->sel) */
if ( selmon - > sel & & selmon - > sel ! = c )
if ( selmon - > sel & & selmon - > sel ! = c )
unfocus ( selmon - > sel , 0 ) ;
unfocus ( selmon - > sel , 0 ) ;
if ( c ) {
if ( c ) {
@ -804,7 +804,7 @@ focus(Client *c)
drawbars ( ) ;
drawbars ( ) ;
}
}
/* there are some broken focus acquiring clients */
/* there are some broken focus acquiring clients needing extra handling */
void
void
focusin ( XEvent * e )
focusin ( XEvent * e )
{
{
@ -823,8 +823,7 @@ focusmon(const Arg *arg)
return ;
return ;
if ( ( m = dirtomon ( arg - > i ) ) = = selmon )
if ( ( m = dirtomon ( arg - > i ) ) = = selmon )
return ;
return ;
unfocus ( selmon - > sel , 0 ) ; /* s/1/0/ fixes input focus issues
unfocus ( selmon - > sel , 0 ) ;
in gedit and anjuta */
selmon = m ;
selmon = m ;
focus ( NULL ) ;
focus ( NULL ) ;
}
}
@ -1516,7 +1515,7 @@ setlayout(const Arg *arg)
drawbar ( selmon ) ;
drawbar ( selmon ) ;
}
}
/* arg > 1.0 will set mfact absolut ly */
/* arg > 1.0 will set mfact absolut e ly */
void
void
setmfact ( const Arg * arg )
setmfact ( const Arg * arg )
{
{
@ -1590,10 +1589,11 @@ setup(void)
XChangeProperty ( dpy , root , netatom [ NetSupported ] , XA_ATOM , 32 ,
XChangeProperty ( dpy , root , netatom [ NetSupported ] , XA_ATOM , 32 ,
PropModeReplace , ( unsigned char * ) netatom , NetLast ) ;
PropModeReplace , ( unsigned char * ) netatom , NetLast ) ;
XDeleteProperty ( dpy , root , netatom [ NetClientList ] ) ;
XDeleteProperty ( dpy , root , netatom [ NetClientList ] ) ;
/* select for events */
/* select events */
wa . cursor = cursor [ CurNormal ] - > cursor ;
wa . cursor = cursor [ CurNormal ] - > cursor ;
wa . event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ButtonPressMask | PointerMotionMask
wa . event_mask = SubstructureRedirectMask | SubstructureNotifyMask
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask | PropertyChangeMask ;
| ButtonPressMask | PointerMotionMask | EnterWindowMask
| LeaveWindowMask | StructureNotifyMask | PropertyChangeMask ;
XChangeWindowAttributes ( dpy , root , CWEventMask | CWCursor , & wa ) ;
XChangeWindowAttributes ( dpy , root , CWEventMask | CWCursor , & wa ) ;
XSelectInput ( dpy , root , wa . event_mask ) ;
XSelectInput ( dpy , root , wa . event_mask ) ;
grabkeys ( ) ;
grabkeys ( ) ;
@ -1769,12 +1769,11 @@ unmanage(Client *c, int destroyed)
Monitor * m = c - > mon ;
Monitor * m = c - > mon ;
XWindowChanges wc ;
XWindowChanges wc ;
/* The server grab construct avoids race conditions. */
detach ( c ) ;
detach ( c ) ;
detachstack ( c ) ;
detachstack ( c ) ;
if ( ! destroyed ) {
if ( ! destroyed ) {
wc . border_width = c - > oldbw ;
wc . border_width = c - > oldbw ;
XGrabServer ( dpy ) ;
XGrabServer ( dpy ) ; /* avoid race conditions */
XSetErrorHandler ( xerrordummy ) ;
XSetErrorHandler ( xerrordummy ) ;
XConfigureWindow ( dpy , c - > win , CWBorderWidth , & wc ) ; /* restore border */
XConfigureWindow ( dpy , c - > win , CWBorderWidth , & wc ) ; /* restore border */
XUngrabButton ( dpy , AnyButton , AnyModifier , c - > win ) ;
XUngrabButton ( dpy , AnyButton , AnyModifier , c - > win ) ;
@ -1871,8 +1870,8 @@ updategeom(void)
memcpy ( & unique [ j + + ] , & info [ i ] , sizeof ( XineramaScreenInfo ) ) ;
memcpy ( & unique [ j + + ] , & info [ i ] , sizeof ( XineramaScreenInfo ) ) ;
XFree ( info ) ;
XFree ( info ) ;
nn = j ;
nn = j ;
if ( n < = nn ) {
if ( n < = nn ) { /* new monitors available */
for ( i = 0 ; i < ( nn - n ) ; i + + ) { /* new monitors available */
for ( i = 0 ; i < ( nn - n ) ; i + + ) {
for ( m = mons ; m & & m - > next ; m = m - > next ) ;
for ( m = mons ; m & & m - > next ; m = m - > next ) ;
if ( m )
if ( m )
m - > next = createmon ( ) ;
m - > next = createmon ( ) ;
@ -1881,8 +1880,8 @@ updategeom(void)
}
}
for ( i = 0 , m = mons ; i < nn & & m ; m = m - > next , i + + )
for ( i = 0 , m = mons ; i < nn & & m ; m = m - > next , i + + )
if ( i > = n
if ( i > = n
| | ( unique [ i ] . x_org ! = m - > mx | | unique [ i ] . y_org ! = m - > my
| | unique [ i ] . x_org ! = m - > mx | | unique [ i ] . y_org ! = m - > my
| | unique [ i ] . width ! = m - > mw | | unique [ i ] . height ! = m - > mh ) )
| | unique [ i ] . width ! = m - > mw | | unique [ i ] . height ! = m - > mh )
{
{
dirty = 1 ;
dirty = 1 ;
m - > num = i ;
m - > num = i ;
@ -1892,13 +1891,11 @@ updategeom(void)
m - > mh = m - > wh = unique [ i ] . height ;
m - > mh = m - > wh = unique [ i ] . height ;
updatebarpos ( m ) ;
updatebarpos ( m ) ;
}
}
} else {
} else { /* less monitors available nn < n */
/* less monitors available nn < n */
for ( i = nn ; i < n ; i + + ) {
for ( i = nn ; i < n ; i + + ) {
for ( m = mons ; m & & m - > next ; m = m - > next ) ;
for ( m = mons ; m & & m - > next ; m = m - > next ) ;
while ( m - > clients ) {
while ( ( c = m - > clients ) ) {
dirty = 1 ;
dirty = 1 ;
c = m - > clients ;
m - > clients = c - > next ;
m - > clients = c - > next ;
detachstack ( c ) ;
detachstack ( c ) ;
c - > mon = mons ;
c - > mon = mons ;
@ -1913,8 +1910,7 @@ updategeom(void)
free ( unique ) ;
free ( unique ) ;
} else
} else
# endif /* XINERAMA */
# endif /* XINERAMA */
/* default monitor setup */
{ /* default monitor setup */
{
if ( ! mons )
if ( ! mons )
mons = createmon ( ) ;
mons = createmon ( ) ;
if ( mons - > mw ! = sw | | mons - > mh ! = sh ) {
if ( mons - > mw ! = sw | | mons - > mh ! = sh ) {