Merge lp:~azzar1/unity/fix-1087422 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: no longer in the source branch.
Merged at revision: 3036
Proposed branch: lp:~azzar1/unity/fix-1087422
Merge into: lp:unity
Diff against target: 58 lines (+29/-1)
2 files modified
plugins/unityshell/src/unityshell.cpp (+2/-1)
tests/autopilot/unity/tests/launcher/test_icon_behavior.py (+27/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1087422
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Marco Trevisan (Treviño) Approve
Thomi Richards (community) Needs Fixing
PS Jenkins bot continuous-integration Pending
Review via email: mp+142706@code.launchpad.net

Commit message

Fix a race condition with windows that start minimized.

Description of the change

== Problem ==
 Windows that start minimized cannot be opened.

== Fix ==
There is a race condition when a window asks to be iconified immediately after gtk_window_show_*. Attached to the bug report [1] is a sample program to test. Run it like so:
valac --pkg gtk+-3.0 test.vala && ./test

== Tests ==
AP tests added.

[1] https://launchpadlibrarian.net/125054880/test.vala

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, so actually what I would propose is to add such functionality to the python-testapp package. Autopilot in Unity anyway uses python-testapp if available, so if we add an ability to create minimized applications on start, we wouldn't be adding any new dependencies and such. What do you think? I could try adding such functionality to the package.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Sounds good to me just make to add two options: one to call window. Iconify
before window.show and viceversa
 On Jan 10, 2013 5:22 PM, "Łukasz Zemczak" <email address hidden>
wrote:

> Ok, so actually what I would propose is to add such functionality to the
> python-testapp package. Autopilot in Unity anyway uses python-testapp if
> available, so if we add an ability to create minimized applications on
> start, we wouldn't be adding any new dependencies and such. What do you
> think? I could try adding such functionality to the package.
> --
> https://code.launchpad.net/~andyrock/unity/fix-1087422/+merge/142706
> You are the owner of lp:~andyrock/unity/fix-1087422.
>

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, so I proposed a feature for iconifying the testapp [1], but will it be a problem that it is a qt application? Since I see you wrote something regarding to gtk things. Is it gtk specific? If yes, we'll have to add a GTK plugin to the testapp - not a big problem, but more writing ;)

[1] https://code.launchpad.net/~sil2100/testapp/add_minimize_function/+merge/142752

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Ok, so I proposed a feature for iconifying the testapp [1], but will it be a
> problem that it is a qt application? Since I see you wrote something regarding
> to gtk things. Is it gtk specific? If yes, we'll have to add a GTK plugin to
> the testapp - not a big problem, but more writing ;)
>
> [1] https://code.launchpad.net/~sil2100/testapp/add_minimize_function/+merge/1
> 42752

No it should not be gtk specific but maybe qt requires a differt code to trigger the bug.

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Yeah - use testapp to test this. I've commented on the testapp MP. This is 'Needs Fixing' Until there's either a unit test or autopilot test though :)

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Uniti side looks fine, though

review: Approve
Revision history for this message
Andrea Azzarone (azzar1) wrote :

AP tests added.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Looks OK, I would just - to be sure, add an eventually statement to the Equals() one, e.g.

42 + self.assertThat(window.x_win.get_wm_state()['state'], Equals(Xutil.NormalState))

self.assertThat(lambda: window.x_win.get_wm_state()['state'], Equals(Xutil.NormalState))

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Looking great now, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unityshell.cpp'
2--- plugins/unityshell/src/unityshell.cpp 2013-01-10 22:03:22 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2013-01-14 11:01:23 +0000
4@@ -2668,7 +2668,8 @@
5 /* Fall through an re-evaluate wraps on map and unmap too */
6 case CompWindowNotifyUnmap:
7 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&
8- window->mapNum ())
9+ window->mapNum () &&
10+ !window->pendingUnmaps())
11 {
12 bool wasMinimized = window->minimized ();
13 if (wasMinimized)
14
15=== modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py'
16--- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2012-11-21 01:35:43 +0000
17+++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2013-01-14 11:01:23 +0000
18@@ -19,6 +19,8 @@
19 from unity.emulators.launcher import IconDragType
20 from unity.tests.launcher import LauncherTestCase, _make_scenarios
21
22+from Xlib import Xutil
23+
24 logger = logging.getLogger(__name__)
25
26
27@@ -219,6 +221,31 @@
28
29 self.assertThat(self.window_manager.expo_active, Eventually(Equals(False)))
30
31+ def test_unminimize_initially_minimized_windows(self):
32+ """Make sure initially minimized windows can be unminimized."""
33+ window_spec = {
34+ "Title": "Hello",
35+ "Minimized": True
36+ }
37+
38+ window = self.launch_test_window(window_spec)
39+ icon = self.launcher.model.get_icon(desktop_id=window.application.desktop_file)
40+
41+ self.launcher_instance.click_launcher_icon(icon)
42+ self.assertThat(lambda: window.x_win.get_wm_state()['state'], Eventually(Equals(Xutil.NormalState)))
43+
44+ def test_unminimize_minimized_immediately_after_show_windows(self):
45+ """Make sure minimized-immediately-after-show windows can be unminimized."""
46+ window_spec = {
47+ "Title": "Hello",
48+ "MinimizeImmediatelyAfterShow": True
49+ }
50+
51+ window = self.launch_test_window(window_spec)
52+ icon = self.launcher.model.get_icon(desktop_id=window.application.desktop_file)
53+
54+ self.launcher_instance.click_launcher_icon(icon)
55+ self.assertThat(lambda: window.x_win.get_wm_state()['state'], Eventually(Equals(Xutil.NormalState)))
56
57 class LauncherDragIconsBehavior(LauncherTestCase):
58 """Tests dragging icons around the Launcher."""