aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/rio
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-08-11 03:38:16 +0000
committerrsc <devnull@localhost>2005-08-11 03:38:16 +0000
commitd52fb463eeda2168b7b0135d758a1e2a57be9af7 (patch)
tree3bad38971b4a86a4558381b61204c8294670c597 /src/cmd/rio
parentb5b71ffbaee0a7a34b93f22541effe76a54c39b5 (diff)
downloadplan9port-d52fb463eeda2168b7b0135d758a1e2a57be9af7.tar.gz
plan9port-d52fb463eeda2168b7b0135d758a1e2a57be9af7.tar.bz2
plan9port-d52fb463eeda2168b7b0135d758a1e2a57be9af7.zip
Fix crash reported by Andrey.
Make focus-follows-mouse easier to find for those who want it (cough, Ron Minnich, cough).
Diffstat (limited to 'src/cmd/rio')
-rw-r--r--src/cmd/rio/dat.h1
-rw-r--r--src/cmd/rio/event.c10
-rw-r--r--src/cmd/rio/main.c9
-rw-r--r--src/cmd/rio/menu.c13
4 files changed, 25 insertions, 8 deletions
diff --git a/src/cmd/rio/dat.h b/src/cmd/rio/dat.h
index b2b74eea..aa08fcf9 100644
--- a/src/cmd/rio/dat.h
+++ b/src/cmd/rio/dat.h
@@ -150,6 +150,7 @@ extern int debug;
extern int solidsweep;
extern int numvirtuals;
extern int scrolling;
+extern int ffm; /* focus follows mouse */
extern Atom exit_rio;
extern Atom restart_rio;
diff --git a/src/cmd/rio/event.c b/src/cmd/rio/event.c
index 45642774..457153df 100644
--- a/src/cmd/rio/event.c
+++ b/src/cmd/rio/event.c
@@ -282,6 +282,7 @@ newwindow(XCreateWindowEvent *e)
void
destroy(Window w)
{
+ int i;
Client *c;
curtime = CurrentTime;
@@ -289,6 +290,11 @@ destroy(Window w)
if(c == 0)
return;
+ if(numvirtuals > 1)
+ for(i=0; i<numvirtuals; i++)
+ if(currents[i] == c)
+ currents[i] = 0;
+
rmclient(c);
/* flush any errors generated by the window's sudden demise */
@@ -470,12 +476,14 @@ enter(XCrossingEvent *e)
Client *c;
curtime = e->time;
+ if(!ffm)
if(e->mode != NotifyGrab || e->detail != NotifyNonlinearVirtual)
return;
c = getclient(e->window, 0);
if(c != 0 && c != current){
/* someone grabbed the pointer; make them current */
- XMapRaised(dpy, c->parent);
+ if(!ffm)
+ XMapRaised(dpy, c->parent);
top(c);
active(c);
}
diff --git a/src/cmd/rio/main.c b/src/cmd/rio/main.c
index bc43a99f..d20c3a00 100644
--- a/src/cmd/rio/main.c
+++ b/src/cmd/rio/main.c
@@ -40,6 +40,7 @@ int scrolling;
int num_screens;
int solidsweep = 0;
int numvirtuals = 0;
+int ffm = 0;
Atom exit_rio;
Atom restart_rio;
@@ -95,6 +96,10 @@ main(int argc, char *argv[])
background = 1;
else if(strcmp(argv[i], "-debug") == 0)
debug++;
+ /*
+ else if(strcmp(argv[i], "-ffm") == 0)
+ ffm++;
+ */
else if(strcmp(argv[i], "-font") == 0 && i+1<argc){
i++;
fname = argv[i];
@@ -335,8 +340,8 @@ initscreen(ScreenInfo *s, int i, int background)
attr.cursor = s->arrow;
attr.event_mask = SubstructureRedirectMask
| SubstructureNotifyMask | ColormapChangeMask
- | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask |
- KeyPressMask;
+ | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask
+ | KeyPressMask | EnterWindowMask;
mask = CWCursor|CWEventMask;
XChangeWindowAttributes(dpy, s->root, mask, &attr);
XSync(dpy, False);
diff --git a/src/cmd/rio/menu.c b/src/cmd/rio/menu.c
index 21195d2e..eb92b744 100644
--- a/src/cmd/rio/menu.c
+++ b/src/cmd/rio/menu.c
@@ -319,7 +319,7 @@ unhide(int n, int map)
}
numhidden--;
- for(i = n; i < numhidden; i ++){
+ for(i = n; i < numhidden; i++){
hiddenc[i] = hiddenc[i+1];
b3items[B3FIXED+i] = b3items[B3FIXED+i+1];
}
@@ -368,8 +368,11 @@ button2(int n)
void
switch_to_c(int n, Client *c)
{
- if(c && c->next)
- switch_to_c(n,c->next);
+ if(c == 0)
+ return;
+
+ if(c->next)
+ switch_to_c(n, c->next);
if(c->parent == DefaultRootWindow(dpy))
return;
@@ -384,8 +387,8 @@ switch_to_c(int n, Client *c)
int i;
for(i = 0; i < numhidden; i++)
- if(c == hiddenc[i])
- break;
+ if(c == hiddenc[i])
+ break;
if(i == numhidden){
XMapWindow(dpy, c->window);