GNOME Bugzilla – Bug 88194
metacity forgets the window which had focus, after restart
Last modified: 2017-03-03 14:15:18 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.
Probably need an XGetInputFocus() call when managing a screen for the first time, just before ungrabbing the server.
Tested on July 15th sources. I could reproduce this problem
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;
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
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 .
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
I am running Sun's stable build 12 - (CVS snapshot date 'Tue Oct 15 15:00:00 BST 2002'). am observing the same behavior
wow this bug gets the record for me too posts.
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.
The patch in bug 158626 may make this easier (all the unmap events won't cause problems anymore...)
Moving things to focus component. Sorry for spam.