From 06a0c62f86fb4096023ce5ee22aa37861180763c Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 10 Dec 2001 00:38:21 +0000 Subject: [PATCH] in click-to-focus mode don't focus on enter notify. Implement unfocusing 2001-12-09 Havoc Pennington * src/display.c (event_callback): in click-to-focus mode don't focus on enter notify. Implement unfocusing on LeaveNotify in mouse focus mode. Click to focus just ends up working if we do nothing on enter/leave, because of the way things already worked. Except I need to add some relatively complex hack to allow clicking on client area, right now you have to click on the frame. --- ChangeLog | 10 ++++++++++ src/display.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d03695e27..0bba052b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-12-09 Havoc Pennington + + * src/display.c (event_callback): in click-to-focus mode don't + focus on enter notify. Implement unfocusing on LeaveNotify in + mouse focus mode. Click to focus just ends up working if we + do nothing on enter/leave, because of the way things already + worked. Except I need to add some relatively complex hack to + allow clicking on client area, right now you have to click + on the frame. + 2001-12-09 Havoc Pennington * src/main.c (main): move SM init a bit later in the process, and diff --git a/src/display.c b/src/display.c index 2145aa121..06de0eccf 100644 --- a/src/display.c +++ b/src/display.c @@ -28,6 +28,7 @@ #include "frame.h" #include "errors.h" #include "keybindings.h" +#include "prefs.h" #include "workspace.h" #include #include @@ -758,7 +759,16 @@ event_callback (XEvent *event, /* do this even if window->has_focus to avoid races */ if (window && event->xany.serial != display->last_ignored_unmap_serial) { - meta_window_focus (window, event->xcrossing.time); + switch (meta_prefs_get_focus_mode ()) + { + case META_FOCUS_MODE_SLOPPY: + case META_FOCUS_MODE_MOUSE: + meta_window_focus (window, event->xcrossing.time); + break; + case META_FOCUS_MODE_CLICK: + break; + } + if (window->type == META_WINDOW_DOCK) meta_window_raise (window); } @@ -766,6 +776,26 @@ event_callback (XEvent *event, case LeaveNotify: if (window) { + switch (meta_prefs_get_focus_mode ()) + { + case META_FOCUS_MODE_MOUSE: + /* This is kind of questionable; but we normally + * set focus to RevertToPointerRoot, so I guess + * leaving it on PointerRoot when nothing is focused + * is probably right. Anyway, unfocus the + * focused window. + */ + if (window->has_focus) + XSetInputFocus (display->xdisplay, + PointerRoot, + RevertToPointerRoot, + event->xcrossing.time); + break; + case META_FOCUS_MODE_SLOPPY: + case META_FOCUS_MODE_CLICK: + break; + } + if (window->type == META_WINDOW_DOCK) meta_window_lower (window); }