Community
Participate
Working Groups
Bugzilla – Bug 287307
[Widgets] [GTK2.18] Control.setZOrder broken on Gtk+ >= 2.17.3
Last modified: 2011-04-13 15:28:59 EDT
In Gtk+ 2.17.3 and onwards (will be the stable 2.18 release eventually) we made GdkWindow able to be non-native (see e.g. http://live.gnome.org/GTK%2B/ClientSideWindows). I got this bug filed about eclipse: http://bugzilla.gnome.org/show_bug.cgi?id=591373 And (I believe) I tracked it down to Control.setZOrder(). This function calls XReconfigureWMWindow() directly on the XWindows from GdkWindow. Now, we do support native GdkWindows mixes with non-native, and if you call gdk_x11_drawable_get_xid() we will on-demand convert the window to native. However, if you change the stacking order (or in general the window hierarchy) behind gdks back things will start going bad, because we use knowledge of this to determine the clipping regions for windows. I assume you are using XReconfigureWMWindow because Gtk+ doesn't have a call for stacking a window above/below a particular sibling. But we can easily add such a call to Gtk+ 2.18 that could be used to fix this. I'm not sure how to fix this for old deployed versions of SWT though. For instance, this bug is likely also the same issue: http://bugzilla.gnome.org/show_bug.cgi?id=590404
Thanks for the info - we are definitely interested in having an API that allows widget ordering (widget ordering would be preferable to just window ordering but we could survive with just window ordering). We have tried out a few scenarios that we thought might break with the new changes. We found that some things work OK and some things have issues. For example, setRedraw() is broken. We found a workaround (which is what makes setEnabled work) in calling gdk_x11_drawable_get_xid() to force a native window to be created. Is this an acceptable workaround or are we going to suffer performance problems?
I added a GDK_NATIVE_WINDOWS env var hack in: http://git.gnome.org/cgit/gtk+/commit/?id=a79f929dd6c89fceeaf0d9039e5a10cad9d87d2f Setting this allows eclipse to work as before. However, it would be nice to add the required APIs so that swt could avoid using X specific APIs, as there are several advantages with client side windows like nicer redrawing and resizing. There is nothing that inherently doesn't work about setRedraw() when using client-side windows. However, in order to correctly emulate a window added like that requires gdk to know the correct stacking order of subwindows, and if SWT calls XReconfigureWMWindow directly then the gdk knowledge of this goes out of sync with reality and things behave differently. Does SWT use NO_WINDOW widgets? Otherwise gdk_window_freeze/thaw_updates() may be a better approach to setRedraw(). Just an idea.
Thanks for the workaround. I guess it will come out in the 2.17.9 release this week? I'll see if I can get some of our users to give it a try on their systems. Just to be clear, if you can provide an API for us to call that will let us set the z-order on widgets, we would definitely give it a try. I'll see if gdk_window_freeze/thaw_updates() will work for us. Thanks for the suggestion!
I added gdk_window_restack() in git master, which will be in the 2.17.11 release. I made a simple test patch for swt to use this and verified that this does in fact solve the http://bugzilla.gnome.org/show_bug.cgi?id=591373 issue. The patch is not acceptable as-is, as it requires some runtime hackery to detect when gdk_window_restack is availible, but i'm sure you guys can easily add it. I'm attaching the patch here and I'm considering the gtk+ bug closed as of this (it works with old swt versions when exporting GDK_NATIVE_WINDOWS, and without it when this patch is applied). There is another swt bug open though, thats not even fixed by GDK_NATIVE_WINDOWS: http://bugzilla.gnome.org/show_bug.cgi?id=589963 I'll try to look at it, but would appreciate any input from you on possible causes of this.
Created attachment 146380 [details] Sample patch using the new gdk API to fix the issue
Thanks for the patch and the code - we will use gdk_window_restack whenever it is available. Fixed in HEAD > 20090910
Created attachment 148442 [details] proposed back-port patch for 3.5.1 I need to back-port this change to 3.5.1 for Fedora 12. I used CVS timestamps to create the attached patch against 3.5.1. Could one of the SWT committers please take a look and see if there's anything that looks incorrect? I'm in the middle of running the tests both with and without it and will verify there are no regressions. Thanks.
Andrew, the patch looks good. We will most likely put this into the 3.5.2 release.
(In reply to comment #8) > Andrew, the patch looks good. We will most likely put this into the 3.5.2 > release. Thanks, Bogdan! Are you tagging SWT + GTK 2.18 issues in bugzilla somehow? I'd like to follow all of these issues and backport all fixes to 3.5.1 for Fedora.
Sounds like a good idea - I'll mark them with [GTK2.18].
Is there a chance to get build towards 3.5.2 that includes this patch?
+1, I'd like to get one before next major release.(and hopefully,the patch feature will be released before 3.5.2 release.Because my RCP App can't run well on major linux near future.) (In reply to comment #11) > Is there a chance to get build towards 3.5.2 that includes this patch?
Backported fix to 3.5.x stream - will be available in next week's M build. Fixed > 20091112
Is the patch I posted here still sufficient for the 3.5.x stream, Bogdan?
Created attachment 152549 [details] error was produced by 3.5.2 M20091118 has the problem been fixed in 3.5.2 M20091118?
Andrew, the path you posted is fine. Yury, the patch for this particular bug went in to the build that you tried. I'm not sure your bug is the same.
sorry, my comment describes problem caused by 291128
Solución en Español: http://blogs.xingular.net/santiago/sistemas-operativos/problemas-con-botones-de-eclipse-en-ubuntu-9-10/
Any chance to get this into the 3.4.2 Maintenance branch in CVS?
*** Bug 288909 has been marked as a duplicate of this bug. ***
*** Bug 305176 has been marked as a duplicate of this bug. ***
Hello, did this fix for this cause a regression in GEF? See Bug 321560
(In reply to comment #22) > Hello, > did this fix for this cause a regression in GEF? See Bug 321560 The changes for this bug are the only changes in SWT between 3.5.1 and 3.5.2 that could cause this problem. Do you have the GDK_NATIVE_WINDOWS env var set when running with 3.5.1? What do we need to load (GEF, etc) to reproduce bug#321560?
(In reply to comment #23) > (In reply to comment #22) > > Hello, > > did this fix for this cause a regression in GEF? See Bug 321560 > > The changes for this bug are the only changes in SWT between 3.5.1 and 3.5.2 > that could cause this problem. > > Do you have the GDK_NATIVE_WINDOWS env var set when running with 3.5.1? > > What do we need to load (GEF, etc) to reproduce bug#321560? Take a look at comment in Bug 321560 for steps to reproduce.
(In reply to comment #24) > (In reply to comment #23) > > (In reply to comment #22) > > > Hello, > > > did this fix for this cause a regression in GEF? See Bug 321560 > > > > The changes for this bug are the only changes in SWT between 3.5.1 and 3.5.2 > > that could cause this problem. > > > > Do you have the GDK_NATIVE_WINDOWS env var set when running with 3.5.1? > > > > What do we need to load (GEF, etc) to reproduce bug#321560? > > Take a look at comment in Bug 321560 for steps to reproduce. I was curious so I tried the steps outlined in that bug: > 1. On Eclipse Linux 3.6.x (try Ubuntu) create a GEF Shapes Example. > 2. Attempt to Resize the Palette in the GEF Shapes Editor. > 3. Now try to type on the keyboard in an Editor - no keyboard input. I can reproduce on Fedora 15. I actually lose keyboard input in dialogues, too (not just editors) ex. new file dialogue. I tried with a Helios SR2 EPP package.
(In reply to comment #25) > (In reply to comment #24) > > (In reply to comment #23) > > > (In reply to comment #22) > > > > Hello, > > > > did this fix for this cause a regression in GEF? See Bug 321560 > > > > > > The changes for this bug are the only changes in SWT between 3.5.1 and 3.5.2 > > > that could cause this problem. > > > > > > Do you have the GDK_NATIVE_WINDOWS env var set when running with 3.5.1? > > > > > > What do we need to load (GEF, etc) to reproduce bug#321560? > > > > Take a look at comment in Bug 321560 for steps to reproduce. > > I was curious so I tried the steps outlined in that bug: > > > 1. On Eclipse Linux 3.6.x (try Ubuntu) create a GEF Shapes Example. > > 2. Attempt to Resize the Palette in the GEF Shapes Editor. > > 3. Now try to type on the keyboard in an Editor - no keyboard input. > > I can reproduce on Fedora 15. I actually lose keyboard input in dialogues, too > (not just editors) ex. new file dialogue. I tried with a Helios SR2 EPP > package. I can now type into the Tasks view find entrybox and other places. I'm not sure what fixed it (I tried Alt-Tab'ing before and it didn't seem to make a difference).
(In reply to comment #23) > (In reply to comment #22) > > Hello, > > did this fix for this cause a regression in GEF? See Bug 321560 > > The changes for this bug are the only changes in SWT between 3.5.1 and 3.5.2 > that could cause this problem. > > Do you have the GDK_NATIVE_WINDOWS env var set when running with 3.5.1? > > What do we need to load (GEF, etc) to reproduce bug#321560? Silenio, I can reproduce it on Ubuntu 10.04 LTS, as outlined in bug #321560, i.e.: 1. On Eclipse Linux 3.6.x (try Ubuntu) create a GEF Shapes Example. 2. Attempt to Resize the Palette in the GEF Shapes Editor. 3. Now try to type on the keyboard in an Editor - no keyboard input. GDK_NATIVE_WINDOWS is not set in my environment. Is that sufficient for you to investigate? Due to your comment #23, re-opening this one because of the regression being introduced. It would be nice if you could deal with the problem for 3.7, as its a quite nasty thing from a GEF viewpoint (while it seems to have been in place for quite some while now).
The bug that caused the GEF regression was not this one but rather Bug 290395. We have opened Bug 342755 to track this. Closing this bug again.