After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 147475 - Switching workspaces with keyboard is blocked if pointer is over the workspace switcher
Switching workspaces with keyboard is blocked if pointer is over the workspac...
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
2.8.x
Other Linux
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
: 100176 114118 145028 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-07-13 11:50 UTC by fork0
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
Focus the no_focus_window if no other window is found to focus (1.01 KB, patch)
2004-08-06 15:21 UTC, Elijah Newren
none Details | Review
use meta_display_get_current_time (1.09 KB, patch)
2004-08-06 16:45 UTC, Elijah Newren
none Details | Review
s/meta_verbose/meta_topic/. :-) (1.05 KB, patch)
2004-08-06 17:49 UTC, Elijah Newren
needs-work Details | Review
I'm a complete moron. (1.12 KB, patch)
2004-08-06 18:04 UTC, Elijah Newren
committed Details | Review
Alternate patch to fix the remaining issue pointed out by Frederic (3.14 KB, patch)
2004-09-13 23:12 UTC, Elijah Newren
accepted-commit_after_freeze Details | Review

Description fork0 2004-07-13 11:50:44 UTC
Select an empty workspace (panels do not count).
Place the pointer at the position where the switcher window will appear
and press your shortcut (Ctrl-Alt-Up/Down here) to the next/previous workspace.
The switcher window appears but the workspace will not change and windowmanager
shortcuts do not work anymore.
Does not happen if the workspace contain any normal windows.
Moving the pointer out and clicking helps (the switcher disappear and
keyboard is back). Pressing Esc/Up/Down/Left/Right doesn't help.
Comment 1 Rob Adams 2004-07-13 15:39:46 UTC
works for me.
Comment 2 Elijah Newren 2004-07-13 16:08:10 UTC
Works for me too.  I believe someone else reported this not too long ago (don't
remember the exact bug number), but they explicitly said to have normal windows
on each desktop (well, and maybe they were maximized too?).  I wonder if this is
distro specific in some way?
Comment 3 Rob Adams 2004-07-13 16:11:00 UTC
Could you give us some distribution/version information, fork0?
Comment 4 fork0 2004-07-13 18:28:39 UTC
SuSE 9.1. That's a machine at work, and though I was sure at that moment it was
2.8.0, I'll recheck tomorrow (SuSE 9.1 still has 2.6.3 according to archives).
I have the problem at home as well (Gentoo, 2.6.5), but isn't always reproducable.
Not at this very moment, for instance ~:/

I have already filed a similar report, btw. But it took some time to find it,
and I lost patience and filed it anew today. The old bug was 114118, filed
against 2.4.
Comment 5 fork0 2004-07-13 18:35:05 UTC
*** Bug 114118 has been marked as a duplicate of this bug. ***
Comment 6 Elijah Newren 2004-07-13 20:00:52 UTC
*** Bug 145028 has been marked as a duplicate of this bug. ***
Comment 7 Elijah Newren 2004-07-13 20:11:06 UTC
Bug 145028 was the other bug I was thinking of.  fork0: What configuration
options do you have set for Metacity?  How reproducable is this for you?  (i.e.
is it like bug 94422 where you do the exact same thing every time and the bug
occurs 5% of the time, or is it something you observe more like 70% of the time?)
Comment 8 fork0 2004-07-13 20:27:22 UTC
For Gentoo (my machine at home): only defaults
For SuSE 9.1 (at work, taken from specfile):
 CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
  ./configure --prefix=%prefix --sysconfdir=%sysconfdir \
    --datadir=%prefix/share --localstatedir=/var/%_lib \
    --libexecdir=%{prefix}/%_lib/metacity --libdir=%prefix/%_lib \
    --disable-schemas-install

The RPM a took this from is at:                     
ftp://ftp.belnet.be/linux/suse/suse/i386/9.1/suse/src/metacity-2.6.3-67.src.rpm
Comment 9 Elijah Newren 2004-07-13 20:33:03 UTC
Thanks, but I was thinking more along the lines of do you have autoraise turned
on, did you set the reduced resources gconf flag to true, etc...
Comment 10 fork0 2004-07-13 20:44:17 UTC
at home: application_based=false, auto_raise=false, disable_workarounds=false,
reduced_resources=false (it's 2.8.1 already, so there probably is no point)

at the office: can't really say, sorry.
The said machine is not available to me now. Will update tomorrow
Comment 11 fork0 2004-07-14 06:57:57 UTC
The version in question is 2.8.0. There is no any special options set (and
listed) in metacity configuration, the only I can think of, disable_workarounds,
is set to false.
I'll retest with 2.8.1 now.
Comment 12 fork0 2004-07-14 07:32:44 UTC
seem to be fixed in 2.8.1.
Comment 13 Vincent Noel 2004-07-20 18:09:34 UTC
The reporter does not see the bug anymore, closing. 
Comment 14 Elijah Newren 2004-08-05 19:38:48 UTC
Aha!  I can duplicate.

1) Set gconf key /apps/metacity/general/focus_mode to mouse (this does NOT
   happen in CVS HEAD with either sloppy or click focus methods, though, 
   considering bug 135810 and what I think is happening, it would have
   occurred for sloppy focus for older releases)

2) Make sure you have a workspace where there is a window underneath where the
   workspace switcher popup window will appear.  (Personally, three of my four
   workspaces were like that when I discovered how to do this)

3) Make sure you have a neighboring workspace where there is NO windows
   underneath where the workspace switcher popup window will appear.

4) Move to the workspace where there is a window beneath that location.

5) Move the mouse to somewhere inside that location where the workspace
   switcher pop window will appear.

6) Use the appropriate ctrl-alt-arrow keybinding to switch to the workspace
   where the mouse won't be in a window (make sure not to move the mouse
   before doing this).

No wonder we couldn't duplicate...that's sort of rare.  :-)
Comment 15 Elijah Newren 2004-08-06 15:21:58 UTC
Created attachment 30281 [details] [review]
Focus the no_focus_window if no other window is found to focus

Here's the patch that fixes the problem for Metacity 2.8.2 and CVS HEAD.  (Due
to the change in bug 135810, it won't cleanly apply to older versions, but
shouldn't be hard to backport; just cut and paste the same stuff to the
appropriate function(s))
Comment 16 Rob Adams 2004-08-06 15:36:39 UTC
ah yes; that would do it.  Good catch.  I don't know how you managed to
reproduce this bug, but I'm glad you did :-)
Comment 17 Elijah Newren 2004-08-06 16:19:40 UTC
Does that imply "accepted; commit now"?  ;-)
Comment 18 Rob Adams 2004-08-06 16:28:06 UTC
Probably should use meta_display_get_current_time instead of CurrentTime there.
 I know it's just going to return CurrentTime, but perhaps, one day, in a better
world, it won't.  I also wonder if we shouldn't have a
meta_display_focus_no_focus_window function, since we have that same big ugly
call to XSetInputFocus in like 4 places now.
Comment 19 Elijah Newren 2004-08-06 16:38:03 UTC
http://tronche.com/gui/x/xlib/input/XSetInputFocus.html claims that if you pass
CurrentTime then the xserver will replace it with the current X server time;
isn't that what we want?
Comment 20 Rob Adams 2004-08-06 16:41:26 UTC
But if we ever call meta_workspace_focus_default_window from inside an event
handler we want it to use the timestamp of the event.  This avoids potential
focus race conditions.  Passing CurrentTime to the X server incidentally always
will replace CurrentTime with the current server time.
Comment 21 Elijah Newren 2004-08-06 16:45:46 UTC
Created attachment 30283 [details] [review]
use meta_display_get_current_time

Ah, that makes sense.

Do you also want me to try to put together a meta_display_focus_no_focus_window
function?  (That does make sense, since I more or less copied from the
LeaveNotify event in display.c in order to figure out how to make this patch. 
:-)
Comment 22 Rob Adams 2004-08-06 17:01:34 UTC
um, sorry to be a curmudgeon, but is there a reason you changed from meta_topic
to meta_verbose?
Comment 23 Elijah Newren 2004-08-06 17:47:09 UTC
Uh, because I was cutting-and-pasting from display.c (event_callback() under the
LeaveNotify case)?  I'll fix the patch and re-post in a minute...
Comment 24 Elijah Newren 2004-08-06 17:49:19 UTC
Created attachment 30284 [details] [review]
s/meta_verbose/meta_topic/.  :-)
Comment 25 Rob Adams 2004-08-06 17:53:16 UTC
Comment on attachment 30284 [details] [review]
s/meta_verbose/meta_topic/.  :-)

Does that compile?

s/meta_topic (/meta_topic (META_DEBUG_FOCUS/

go ahead and commit with that change :-)
Comment 26 Elijah Newren 2004-08-06 18:04:39 UTC
Created attachment 30285 [details] [review]
I'm a complete moron.

WHHOOOOOOPPPSS.  :-}  Here's the patch that compiles.  I'll commit in just a
minute.
Comment 27 Elijah Newren 2004-08-06 18:14:47 UTC
commited.
Comment 28 Frederic Crozat 2004-09-10 17:31:51 UTC
Reopening, bug isn't completely fixed with this patch..

Better test case scenario :

1/start X with only a terminal inside (startx /usr/X11R6/bin/rxvt for instance)
2/in that terminal, run metacity 
3/make sure mouse focus is the current mode
4/position mouse cursor on the location of the worspace switcher
5/press Ctrl-Alt-Right to switch to a completely empty workspace

=> workspace switcher won't disappear when releasing keys combinaison.

Patch seems to work only if at least one window can be focus in the workspace
(which is often the case if you have a panel but not always).

Comment 29 Elijah Newren 2004-09-10 18:03:59 UTC
First, do you really mean 'mouse' focus, or do you mean sloppy focus?  (Sorry to
ask, but many people mix them up).  I can think of a case where this would
happen for both sloppy focus and click-to-focus, and the following patch should
fix that:

Index: src/workspace.c
===================================================================
RCS file: /cvs/gnome/metacity/src/workspace.c,v
retrieving revision 1.60
diff -p -u -r1.60 workspace.c
--- src/workspace.c     27 Aug 2004 17:22:54 -0000      1.60
+++ src/workspace.c     10 Sep 2004 18:00:13 -0000
@@ -899,6 +899,12 @@ meta_workspace_focus_top_window (MetaWor
     }
   else
     {
-      meta_topic (META_DEBUG_FOCUS, "No top window to focus found\n");
+      meta_topic (META_DEBUG_FOCUS,
+                  "Setting focus to no_focus_window, since absolutely no "
+                  "windows exist.\n");
+      XSetInputFocus (workspace->screen->display->xdisplay,
+                      workspace->screen->display->no_focus_window,
+                      RevertToPointerRoot,
+                      meta_display_get_current_time (workspace->screen->display));
     }
 }

But this shouldn't affect mouse focus.

Second, you might just be a experiencing bug 151554 (which I believe is the same
as bug 142947 and bug 152169); we'd need to know the output of xmodmap and which
ctrl and alt keys you are using to find out.
Comment 30 Frederic Crozat 2004-09-11 20:42:08 UTC
Argggggggg, I thought just enabling "focus follow mouse" in metacity capplet was
enabling mouse focus, not sloppy focus (now, you can say : Mdk metacity packager
didn't knew difference between sloppy and mouse focus :)). My test case was in
fact in sloppy focus mode, while I thought I was testing mouse focus mode.

I've got reports from other people on Mdk bug
http://qa.mandrakesoft.com/show_bug.cgi?id=11359.

I'll try this patch on Monday and I'll let you know but it is probably fixing
the issue..
Comment 31 Frederic Crozat 2004-09-13 12:38:39 UTC
Confirmed, it is fixed with this patch.

Leaving bug opened until patch is committed..
Comment 32 Elijah Newren 2004-09-13 23:12:56 UTC
Created attachment 31540 [details] [review]
Alternate patch to fix the remaining issue pointed out by Frederic

Here's a patch that depends on the one in bug 151990 being applied first.  In
addition to fixing the bug Frederic pointed out, this patch makes the panel and
desktop windows only be focused when the user explicitly requests it (which we
claimed we were doing before, but it was a lie).  Doing this extra thing allows
a little bit of code clean-up to be taken care of at the same time.
Comment 33 Havoc Pennington 2004-09-14 03:02:17 UTC
Comment on attachment 31540 [details] [review]
Alternate patch to fix the remaining issue pointed out by Frederic

Seems logical to me, thanks.
Comment 34 Havoc Pennington 2004-09-14 03:02:36 UTC
Comment on attachment 30285 [details] [review]
I'm a complete moron.

Should this really be flagged committed?
Comment 35 Elijah Newren 2004-09-14 03:11:25 UTC
Yes, attachment 30285 [details] [review] was committed over a month ago; I never marked it as
committed at that time because I just marked the bug as fixed instead.  After
Frederic reopened this bug and I posted a new patch, I didn't want you getting
confused about which patch to look at, so I marked the old patch that had been
applied to CVS as committed.  

(As to the differences between the patches: Note that while the 30285 patch
looks very similar, it was actually code for the focus_default_window function,
while the newer patches are for the focus_mru_window and focus_top_window functions)
Comment 36 Elijah Newren 2004-09-15 16:53:37 UTC
committed.
Comment 37 Elijah Newren 2004-11-06 18:42:33 UTC
*** Bug 100176 has been marked as a duplicate of this bug. ***