summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-12-10 00:38:21 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-12-10 00:38:21 +0000
commit06a0c62f86fb4096023ce5ee22aa37861180763c (patch)
tree0bfc6d7ff7c32b6b1350f59207f413894eb52124 /src
parent6981a8198bdce947fa2f43a28babe427e740282b (diff)
downloadmetacity-06a0c62f86fb4096023ce5ee22aa37861180763c.tar.gz
metacity-06a0c62f86fb4096023ce5ee22aa37861180763c.tar.bz2
in click-to-focus mode don't focus on enter notify. Implement unfocusing
2001-12-09 Havoc Pennington <hp@pobox.com> * 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.
Diffstat (limited to 'src')
-rw-r--r--src/display.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/display.c b/src/display.c
index 2145aa1..06de0ec 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 <X11/Xatom.h>
#include <X11/cursorfont.h>
@@ -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);
}