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 88194 - metacity forgets the window which had focus, after restart
metacity forgets the window which had focus, after restart
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: Focus
2.8.x
Other All
: Normal minor
: future
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on: 90382
Blocks: 155450
 
 
Reported: 2002-07-15 05:36 UTC by Jathish
Modified: 2017-03-03 14:15 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Jathish 2002-07-15 05:36:03 UTC
Tested on sources taken on July 10th
Description:
metacity forgets the window which had focus, after restart.

Steps:
1.Invoke some application (say calculator)and invoke some other 
application say terminal and focus the terminal window
2.type pkill metacity; metacity & at the command prompt.

The metacity is killed and restarted but the terminal which had focus 
before resarting is not focussed back.
Comment 1 Havoc Pennington 2002-07-15 13:57:59 UTC
Probably need an XGetInputFocus() call when managing a screen for the
first time, just before ungrabbing the server.
Comment 2 Jathish 2002-07-23 06:17:33 UTC
Tested on July 15th sources. I could reproduce this problem
Comment 3 JeyaSudha 2002-07-29 06:18:18 UTC
Still it is not working. The reason may be the focussed window is of
type DESKTOP or DOCK. The focus can be given in a better way by
checking the window type during the window creation and giving it the
XSetInputFocus, window_show, window_raise.

if (window->type!= META_WINDOW_DESKTOP &&
window->type!=META_WINDOW_DOCK && meta_window_get_net_wm_desktop
(window) == 0)
    window->display->save_focus_window = window;


Comment 4 Mamatha 2002-09-13 11:20:19 UTC
I tested with Sun beta 2 build 6 package. Source taken from "Tue Aug
27 14:57:39 BST 2002".
I am able to observe the same behavior
Comment 5 Mamatha 2002-09-25 05:34:06 UTC
I'm running Sun's beta 2 build 9 source (17th Sep snapshot from CVS).

1.Invoke calculator and invoke some other application say terminal 
and focus the terminal window.
 
2.type pkill metacity; metacity & at the command prompt.
The metacity is killed and restarted. 

If the focus mode is 'Click to give focus' -the terminal which had 
focus  before resarting is not focussed back. 

If the focus mode is 'Point to give focus' - it is working fine.i.e 
the terminal which had focus  before resarting is got focus .
Comment 6 Mamatha 2002-10-08 13:09:29 UTC
I'm running Sun's beta 2 build 11 source - Tue Oct 1 13:26:01 BST 2002

A)metacity forgets the window which had focus, after restart

1. Invoke calculator in workspace1 and invoke some other application 
say gedit in second workspace2.
 
3. Invoke terminal on workspace3 and type pkill metacity; metacity & 
at the command prompt. 
The metacity killed and restarted. 
Now the focus is on first workspace .But the calculator in first 
workspace does not have the focus. The 'Calculator' will get focus 
only when
1) Moved to any other workspace and come back to workspace1 
2) Click on the 'Calculator'


B) 
Metacity does not remember the last focused window and position of 
the windows in all other workspaces when it is killed and restarted. 

C) Metacity does not maintains the depth order, when it is killed and 
restarted

Comment 7 Mamatha 2002-10-24 16:40:41 UTC
I am running Sun's stable build 12 - (CVS snapshot date 'Tue Oct 15
15:00:00 BST 2002').
am observing the same behavior
Comment 8 Rob Adams 2003-05-30 20:55:38 UTC
wow this bug gets the record for me too posts.
Comment 9 Elijah Newren 2004-10-06 19:17:57 UTC
I looked into this a week or so ago.  Unfortunately, I came up a little
empty-handed.  Some notes that I jotted down around the time (actually the notes
were a little more terse and I may not have filled in all the details totally
correctly):

The relevant function appears to be meta_display_open.  Note that it creates
screens, and each screen activates at least one worspace, and activating a
workspace focuses the default window on the workspace as a side effect.  The
XGetInputFocus call comes after all this--oops.  Also, the code merely punts to
focusing the no_focus_window if XGetInputFocus doesn't return a valid window.  A
better course of action would be to call meta_workspace_focus_default_window. 
However, if one fixes these issues and makes sure to manually focus the correct
window, a lot of Unmap events are still received afterwards which causes the
window to become/appear unfocused.
Comment 10 Elijah Newren 2005-02-13 01:15:03 UTC
The patch in bug 158626 may make this easier (all the unmap events won't cause
problems anymore...)
Comment 11 Thomas Thurman 2008-04-20 20:19:39 UTC
Moving things to focus component.  Sorry for spam.