Merge lp:~ken-vandine/ubuntu-app-launch/ual_focus_app into lp:ubuntu-app-launch
- ual_focus_app
- Merge into trunk.17.04
Status: | Merged |
---|---|
Approved by: | Ted Gould |
Approved revision: | 340 |
Merged at revision: | 289 |
Proposed branch: | lp:~ken-vandine/ubuntu-app-launch/ual_focus_app |
Merge into: | lp:ubuntu-app-launch |
Prerequisite: | lp:~ken-vandine/ubuntu-app-launch/api3_abi4 |
Diff against target: |
114 lines (+53/-0) 5 files modified
libubuntu-app-launch/application-impl-base.cpp (+12/-0) libubuntu-app-launch/application-impl-base.h (+1/-0) libubuntu-app-launch/application.h (+8/-0) libubuntu-app-launch/jobs-base.cpp (+31/-0) libubuntu-app-launch/jobs-base.h (+1/-0) |
To merge this branch: | bzr merge lp:~ken-vandine/ubuntu-app-launch/ual_focus_app |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
unity-api-1-bot | continuous-integration | Needs Fixing | |
Ted Gould (community) | Approve | ||
Review via email: mp+316741@code.launchpad.net |
This proposal supersedes a proposal from 2017-02-03.
Commit message
Adds Application:
Description of the change
Adds Application:
No tests yet and ubuntu-app-focus is just for my testing, i'll remove it later.
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:323
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:324
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:325
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Ted Gould (ted) wrote : Posted in a previous version of this proposal | # |
A few pointers, I imagine returning the wrong signal is your issue though:
* You don't need an implementation of findInstance() for every subclass. One in Base:: would work for every subclass because it'd use that subclass' instances() function.
* I think you implemented ::focus for Jobs::Upstart as well as Jobs::Base, which means it's probably not being used. (and will go away soon)
* Registry:
* I would add a focused to ubuntu-app-watch, makes debugging this stuff easier.
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:327
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:328
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Ken VanDine (ken-vandine) wrote : Posted in a previous version of this proposal | # |
> A few pointers, I imagine returning the wrong signal is your issue though:
>
> * You don't need an implementation of findInstance() for every subclass. One
> in Base:: would work for every subclass because it'd use that subclass'
> instances() function.
Done
> * I think you implemented ::focus for Jobs::Upstart as well as Jobs::Base,
> which means it's probably not being used. (and will go away soon)
>
> * Registry:
Fixed
> * I would add a focused to ubuntu-app-watch, makes debugging this stuff
> easier.
Done
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:329
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:330
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:332
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:333
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:334
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:335
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 337. By Ken VanDine
-
merged prereq
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:336
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:337
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 338. By Ken VanDine
-
Added Breaks/Replaces for libubuntu-
app-launch2- dev - 339. By Ken VanDine
-
merged prereq
- 340. By Ken VanDine
-
Removed the last of ApplicationFocused
Ted Gould (ted) : | # |
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:338
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'libubuntu-app-launch/application-impl-base.cpp' |
2 | --- libubuntu-app-launch/application-impl-base.cpp 2017-01-27 20:43:28 +0000 |
3 | +++ libubuntu-app-launch/application-impl-base.cpp 2017-02-10 15:30:01 +0000 |
4 | @@ -121,6 +121,18 @@ |
5 | } |
6 | } |
7 | |
8 | +std::shared_ptr<Application::Instance> Base::findInstance(const pid_t& pid) |
9 | +{ |
10 | + for (auto instance : instances()) |
11 | + { |
12 | + if (instance->hasPid(pid)) |
13 | + { |
14 | + return instance; |
15 | + } |
16 | + } |
17 | + return nullptr; |
18 | +} |
19 | + |
20 | } // namespace app_impls |
21 | } // namespace app_launch |
22 | } // namespace ubuntu |
23 | |
24 | === modified file 'libubuntu-app-launch/application-impl-base.h' |
25 | --- libubuntu-app-launch/application-impl-base.h 2017-01-26 22:33:36 +0000 |
26 | +++ libubuntu-app-launch/application-impl-base.h 2017-02-10 15:30:01 +0000 |
27 | @@ -47,6 +47,7 @@ |
28 | |
29 | std::string getInstance(const std::shared_ptr<app_info::Desktop>& desktop) const; |
30 | virtual std::shared_ptr<Application::Instance> findInstance(const std::string& instanceid) = 0; |
31 | + std::shared_ptr<Application::Instance> findInstance(const pid_t& pid); |
32 | |
33 | protected: |
34 | /** Pointer to the registry so we can ask it for things */ |
35 | |
36 | === modified file 'libubuntu-app-launch/application.h' |
37 | --- libubuntu-app-launch/application.h 2016-08-17 15:24:30 +0000 |
38 | +++ libubuntu-app-launch/application.h 2017-02-10 15:30:01 +0000 |
39 | @@ -251,6 +251,8 @@ |
40 | /** Stop, or send SIGTERM, to the PIDs in this Application::Instance, if |
41 | the PIDs do not respond to the SIGTERM they will be SIGKILL'd */ |
42 | virtual void stop() = 0; |
43 | + /** Signal the shell to focus the Application::Instance */ |
44 | + virtual void focus() = 0; |
45 | }; |
46 | |
47 | /** A quick check to see if this application has any running instances */ |
48 | @@ -269,6 +271,12 @@ |
49 | \param urls A list of URLs to pass to the application command line |
50 | */ |
51 | virtual std::shared_ptr<Instance> launchTest(const std::vector<URL>& urls = {}) = 0; |
52 | + |
53 | + /** Get a a pointer to the running instances of this application based on the pid |
54 | + |
55 | + \param pid The pid to find the instance of |
56 | + */ |
57 | + virtual std::shared_ptr<Instance> findInstance(const pid_t& pid) = 0; |
58 | }; |
59 | |
60 | } // namespace app_launch |
61 | |
62 | === modified file 'libubuntu-app-launch/jobs-base.cpp' |
63 | --- libubuntu-app-launch/jobs-base.cpp 2017-01-26 22:46:06 +0000 |
64 | +++ libubuntu-app-launch/jobs-base.cpp 2017-02-10 15:30:01 +0000 |
65 | @@ -497,6 +497,37 @@ |
66 | pidListToDbus(registry_, appId_, instance_, pids, "ApplicationResumed"); |
67 | } |
68 | |
69 | +/** Focuses this application by sending SIGCONT to all the PIDs in the |
70 | + cgroup and tells the Shell to focus the application. */ |
71 | +void Base::focus() |
72 | +{ |
73 | + g_debug("Focusing application: %s", std::string(appId_).c_str()); |
74 | + |
75 | + GError* error = nullptr; |
76 | + GVariantBuilder params; |
77 | + g_variant_builder_init(¶ms, G_VARIANT_TYPE_TUPLE); |
78 | + g_variant_builder_add_value(¶ms, g_variant_new_string(std::string(appId_).c_str())); |
79 | + g_variant_builder_add_value(¶ms, g_variant_new_string(instance_.c_str())); |
80 | + g_dbus_connection_emit_signal(registry_->impl->_dbus.get(), /* bus */ |
81 | + nullptr, /* destination */ |
82 | + "/", /* path */ |
83 | + "com.canonical.UbuntuAppLaunch", /* interface */ |
84 | + "UnityFocusRequest", /* signal */ |
85 | + g_variant_builder_end(¶ms), /* params */ |
86 | + &error); /* error */ |
87 | + |
88 | + if (error != nullptr) |
89 | + { |
90 | + g_warning("Unable to emit signal 'UnityFocusRequest' for appid '%s': '%s'", std::string(appId_).c_str(), |
91 | + error->message); |
92 | + g_error_free(error); |
93 | + } |
94 | + else |
95 | + { |
96 | + g_debug("Emmitted 'UnityFocusRequest' to DBus"); |
97 | + } |
98 | +} |
99 | + |
100 | /** Go through the list of PIDs calling a function and handling |
101 | the issue with getting PIDs being a racey condition. |
102 | |
103 | |
104 | === modified file 'libubuntu-app-launch/jobs-base.h' |
105 | --- libubuntu-app-launch/jobs-base.h 2017-01-26 22:46:06 +0000 |
106 | +++ libubuntu-app-launch/jobs-base.h 2017-02-10 15:30:01 +0000 |
107 | @@ -49,6 +49,7 @@ |
108 | bool hasPid(pid_t pid) override; |
109 | void pause() override; |
110 | void resume() override; |
111 | + void focus() override; |
112 | |
113 | /* OOM Functions */ |
114 | void setOomAdjustment(const oom::Score score) override; |
FAILED: Continuous integration, rev:322 /jenkins. canonical. com/unity- api-1/job/ lp-ubuntu- app-launch- ci/201/ /jenkins. canonical. com/unity- api-1/job/ build/1595/ console /jenkins. canonical. com/unity- api-1/job/ build-0- fetch/1602 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1380/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= zesty/1380/ console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1380/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= zesty/1380/ console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1380/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= zesty/1380/ console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/unity- api-1/job/ lp-ubuntu- app-launch- ci/201/ rebuild
https:/