GNOME Bugzilla – Bug 84986
gedit not fully session aware
Last modified: 2009-08-15 18:40:50 UTC
testing on ultra 10 with solaris 8 I started gnome-session and opened the following apps in the following workspaces: workspace app -------- ----- 1 gnome-calculator 2 gedit 3 eye of gnome When I logged out and in gedit had moved from workspace2 to workspace1.
That is a window manager issue, isn't it? The window manager stores window positions and sizes, not the app. The app just needs to identify its windows. (If I'm wrong, let me know, as Glade is broken as well then!)
It's a GEdit bug. It does not restore its window roles correctly. It should be using the same roles as it saved for the session.
Federico: are you sure? I should have fixed the role problem 2 or 3 weeks ago. I'm not sure, but the problem could be cause by a call to gtk_window_present. We only need to find it.
OK, the problem is as follows. When bonobo-mdi-session restores a child with restore_window_child(), it passes an "init" argument saying whether a new window should be created for the view, or if it should just be a new view that gets inserted in an existing window. When restore_window_child() creates a new window in line bonobo-mdi-session.c:143, the code in gedit_mdi_app_created_handler() sets a new window role; the code in bonobo_mdi_open_toplevel() then shows the window and therefore realizes it. But afterwards, bonobo-mdi-session.c:146 tries to re-set the role, and you can't set the role on a window that is already realized. The role string does get stored in the GtkWindow structure, but it is never passed on to the GdkWindow as it is already realized.
Attaching patch. I'm just waiting on confirmation from the release team to apply it.
Created attachment 9284 [details] [review] Patch with proposed fix.
Fixed on CVS.
I've just looked at this on a build from cvs 25th june and problems still exist - as above I set up 5 workspaces and placed apps as follows Workspace 1 - gnome-calculator Workspace 2 - gedit Workspace 3 - eog I logged out and ticked save session box. Logged back in and - Only had 2 workspaces present (3 missing) - Workspace2 was current display - Gedit was displayed in Worksace 2 but Nautilus application was also opened (home folder) in Workspace 2 - Workspace 3 (with eog), 4 & 5 disappeared - Desktop icons all sitting on top of each other. Could fix have had an adverse impact? I'm logging a new bug against gnome-session - bug #86539
marking as verified - gedit remains in correct workspace - see above for details of new bug opened against gnome-session
closing
this bug is present again in a nightly that was built from CVS on 14th July. re-opening. started gedit in workspace 2, logged out, saved session, logged back in and gedit starts in workspace 1
Okay, it would be useful to get information about the following: 1. Start GEdit. Open a file. 2. Use xprop to get the value of WM_WINDOW_ROLE in the GEdit window. 3. Close your session. 4. Restart your session. 5. See if the GEdit window that launches has the same value for the WM_WINDOW_ROLE property. If the value is the same, then it is a bug in the window manager. If it is not the same, it is a bug in GEdit, which is unlikely, because I already fixed that.
wierd - i can't reproduce this.... was I dreaming it (????). sorry about that - am closing. fyi - i couldn't get a value for WM_WINDOW_ROLE if gedit had _any_ files open (including new files)..
.... the saga continues.... :) I've checked this again and found that if gedit has any type of file open (new or existing) then after logging out, saving session & logging back in again it will always start in workspace 1. i can't get a value for WM_WINDOW_ROLE when there is a file open in gedit - it seems this property is only set when there is no file open. Running xprop reveals diffs between WM_CLIENT_LEADER(WINDOW), _NET_WM_PID(CARDINAL) & window id # of group leader. Before logging out =============== WM_CLIENT_LEADER(WINDOW): window id # 0x5000001 _NET_WM_PID(CARDINAL) = 27926 window id # of group leader: 0x5000001 After loggin in ============ WM_CLIENT_LEADER(WINDOW): window id # 0x5800001 _NET_WM_PID(CARDINAL) = 28079 window id # of group leader: 0x5800001 I have listed _all_ the properties returned by xprop before logging out and after logging back in: Before logging out ================ _XEMBED_INFO(_XEMBED_INFO) = 0x1191d8, 0x0 WM_CLASS(STRING) = "gedit", "Gedit" WM_ICON_NAME(STRING) = "gedit" _NET_WM_ICON_NAME(UTF8_STRING) = 0x67, 0x65, 0x64, 0x69, 0x74 WM_NAME(STRING) = "gedit" _NET_WM_NAME(UTF8_STRING) = 0x67, 0x65, 0x64, 0x69, 0x74 WM_CLIENT_LEADER(WINDOW): window id # 0x5000001 _NET_WM_PID(CARDINAL) = 27926 WM_CLIENT_MACHINE(STRING) = "cdedesk1" WM_HINTS(WM_HINTS): Initial state is Normal State. window id # of group leader: 0x5000001 WM_NORMAL_HINTS(WM_SIZE_HINTS): program specified minimum size: 150 by 10 window gravity: NorthWest WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING After logging in again =================== _XEMBED_INFO(_XEMBED_INFO) = 0x1191d8, 0x0 WM_CLASS(STRING) = "gedit", "Gedit" WM_ICON_NAME(STRING) = "gedit" _NET_WM_ICON_NAME(UTF8_STRING) = 0x67, 0x65, 0x64, 0x69, 0x74 WM_NAME(STRING) = "gedit" _NET_WM_NAME(UTF8_STRING) = 0x67, 0x65, 0x64, 0x69, 0x74 WM_CLIENT_LEADER(WINDOW): window id # 0x5800001 _NET_WM_PID(CARDINAL) = 28079 WM_CLIENT_MACHINE(STRING) = "cdedesk1" WM_HINTS(WM_HINTS): Initial state is Normal State. window id # of group leader: 0x5800001 WM_NORMAL_HINTS(WM_SIZE_HINTS): program specified minimum size: 150 by 10 window gravity: NorthWest WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING
Okay, please do this: 1. Run gedit. 2. Run "xprop > before.txt" and click on the gedit window. 3. Open a text file in that gedit window. 4. Run "xprop > after.txt" and click on the gedit window. 5. Close your session while saving it. 6. Ssh into your machine from another box and find a file called "~/.gnome2/gedit-XXXXXX", where XXXXXX is six random letters. Make sure it is the file with the latest modification date. Please attach it to this bug report. 6. Restart your session. 7. Find the gedit window, run "xprop > session.txt" and click on the gedit window. 5. Please attach before.txt, after.txt, and session.txt to this bug report. The client leader, PID, and group leader will be different when you restart your session because you have a different process with a PID that is different from the original one, and because your X windows will not have the same IDs, either. The role should be the same.
Created attachment 10210 [details] xprop output before opening file in gedit or saving gnome session - gedit is in workspace2
Created attachment 10211 [details] xprop output after opening file in gedit and before saving gnome session
Created attachment 10212 [details] xprop output after logging out, saving session and logging back in - gedit has moved from workspace2 to workspace1
Created attachment 10213 [details] gedit session file
Hmm, these all indicate that GEdit is doing the right thing. Are you using metacity? If so, could you please attach its corresponding session file from ~/.metacity/sessions? Thanks!
Created attachment 10296 [details] I've recreated the problem and am attaching the metacity session file.
I have confirmed that this is a Metacity bug, so marking as duplicate. This works fine in Sawfish. *** This bug has been marked as a duplicate of 90133 ***