Bug 347579 - Metacity-Hack in Shell breaks things instead of fixing them
Summary: Metacity-Hack in Shell breaks things instead of fixing them
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.9 M2   Edit
Assignee: Eric Williams CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2011-05-29 11:32 EDT by Daniel Migowski CLA
Modified: 2018-08-03 10:03 EDT (History)
6 users (show)

See Also:


Attachments
Snippet to test the behaviour. (2.50 KB, text/x-java)
2011-05-29 11:32 EDT, Daniel Migowski CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Migowski CLA 2011-05-29 11:32:10 EDT
Created attachment 196850 [details]
Snippet to test the behaviour.

I have problems using the forceActive() function in Shell, on Linux-gdk with a Metacity 2.22 window manager.

The source code of Shell contains the following lines:

		/*
		* Bug in metacity.  Calling gdk_window_focus() with a timestamp more
		* recent than the last user interaction time can cause windows not
		* to come forward in versions > 2.10.0.  The fix is to use the last
		* user event time. 
		*/
		if (display.windowManager.toLowerCase ().equals ("metacity")) {
			OS.gdk_window_focus (window, display.lastUserEventTime);
		} else {
			OS.gdk_window_focus (window, OS.GDK_CURRENT_TIME);
		}

In my case the lastUserEventTime hack does not work, but the other line the the OS.GDK_CURRENT_TIME does.

To reproduce try my attached snipped. It will create a shell with a tree and waits for input on the command line. For each time pressing enter here (I usually do this from within my Eclise IDEs console), the window should be brought to front, but this does not work here. Only if I override the windowmanager in Display the function works. 

I do not know in which cases the hack is needed, but for me it just breaks things. PS: Bringing the window to front in my snippet forst works, since lastUserEventTime is still 0 then, which is the same as the OS constant.

Please remove this hack altogether until you find more information on when it is really needed. Please contact me if you need more info.

PS: I tested this with SWT 3.5.2, but 3.6.2 also still contains this piece of code.
Comment 1 Eclipse Genie CLA 2018-06-20 15:32:19 EDT
New Gerrit change created: https://git.eclipse.org/r/124799
Comment 3 Eric Williams CLA 2018-06-20 15:49:14 EDT
(In reply to Eclipse Genie from comment #2)
> Gerrit change https://git.eclipse.org/r/124799 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=48e508c2ce47ad9cf833776891ac30e305bfd84e

Patch is merged, removed dead metacity code.