Merge lp:~ksamak/compiz/showmouse_autostart_option into lp:compiz/0.9.13

Proposed by ksamak
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4110
Merged at revision: 4120
Proposed branch: lp:~ksamak/compiz/showmouse_autostart_option
Merge into: lp:compiz/0.9.13
Diff against target: 60 lines (+21/-0)
3 files modified
plugins/showmouse/showmouse.xml.in (+5/-0)
plugins/showmouse/src/showmouse.cpp (+13/-0)
plugins/showmouse/src/showmouse.h (+3/-0)
To merge this branch: bzr merge lp:~ksamak/compiz/showmouse_autostart_option
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
ksamak (community) Approve
Andrea Azzarone Needs Fixing
Sam Spilsbury Pending
Review via email: mp+318725@code.launchpad.net

This proposal supersedes a proposal from 2017-01-26.

Commit message

showmouse: added autostart option

Description of the change

added startup option to showmouse plugin

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) : Posted in a previous version of this proposal
Revision history for this message
ksamak (ksamak) wrote : Posted in a previous version of this proposal

hi,
fixed indentation, and commented on timer use.
thanks for your time.

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

I'm just wondering, as Sam asked, why you need a Timer here...

Revision history for this message
ksamak (ksamak) wrote :

> I'm just wondering, as Sam asked, why you need a Timer here...

pasting:
I tried optionGetActivateAtStartup() in the constructor, but I think GSettings aren't initialized yet if the object isn't constructed.
The optionGetActivateAtStartup function only returns default value (0) if placed in constructor, or in function called by constructor. I don't know of any other mean to bypass this except a timer.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> > I'm just wondering, as Sam asked, why you need a Timer here...
>
> pasting:
> I tried optionGetActivateAtStartup() in the constructor, but I think GSettings
> aren't initialized yet if the object isn't constructed.
> The optionGetActivateAtStartup function only returns default value (0) if
> placed in constructor, or in function called by constructor. I don't know of
> any other mean to bypass this except a timer.

I had a look around and you're right - it looks like the compizconfig plugin itself applies settings on an idle timer at startup. I'm not sure why that is exactly, but we'll have to work around it.

One option is to use timeout handler like this. I suppose another option is that if the setting will remain off by default, you could use optionGetActivateAtStartupNotify to receive a callback when the setting changes from false to true and then use that to activate the plugin.

I also note that the way the keybindings are done here are such that holding down the keys initiates the effect whereas releasing them terminates it. I would imagine such behaviour would have to be inverted in the "on-by-default" case.

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

Yes remove the timer please. Use the same "workaround" you wrote for the neg plugin.

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

Any update here?

4109. By ksamak <ksamak@ksalaptop>

showmouse: used Notify trick to implement startup mechanism

4110. By ksamak <ksamak@ksalaptop>

coding style

Revision history for this message
ksamak (ksamak) wrote :

Yes, i did adapt to use the same workaround.

review: Needs Resubmitting
Revision history for this message
ksamak (ksamak) wrote :

> Yes, i did adapt to use the same workaround.

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

Ack

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/showmouse/showmouse.xml.in'
2--- plugins/showmouse/showmouse.xml.in 2016-05-31 17:30:42 +0000
3+++ plugins/showmouse/showmouse.xml.in 2017-04-20 13:04:37 +0000
4@@ -19,6 +19,11 @@
5 <options>
6 <group>
7 <_short>General</_short>
8+ <option name="activate_at_startup" type="bool">
9+ <_short>plugin should be active at startup</_short>
10+ <_long>If active, the plugin will start active, with the mouse enhanced</_long>
11+ <default>false</default>
12+ </option>
13 <option name="initiate" type="key">
14 <_short>Initiate</_short>
15 <_long>Toggle the mouse pointer trail.</_long>
16
17=== modified file 'plugins/showmouse/src/showmouse.cpp'
18--- plugins/showmouse/src/showmouse.cpp 2016-05-31 17:30:42 +0000
19+++ plugins/showmouse/src/showmouse.cpp 2017-04-20 13:04:37 +0000
20@@ -660,6 +660,17 @@
21 return true;
22 }
23
24+void
25+ShowmouseScreen::startupToggle ()
26+{
27+ if (optionGetActivateAtStartup ())
28+ {
29+ active = true;
30+ toggleFunctions (true);
31+ gScreen->glPaintOutputSetEnabled (gScreen, true);
32+ }
33+}
34+
35 ShowmouseScreen::ShowmouseScreen (CompScreen *screen) :
36 PluginClassHandler <ShowmouseScreen, CompScreen> (screen),
37 cScreen (CompositeScreen::get (screen)),
38@@ -687,6 +698,8 @@
39 this, _1, _2, _3));
40 optionSetInitiateEdgeTerminate (boost::bind (&ShowmouseScreen::terminate,
41 this, _1, _2, _3));
42+
43+ optionSetActivateAtStartupNotify (boost::bind (&ShowmouseScreen::startupToggle, this));
44 }
45
46 ShowmouseScreen::~ShowmouseScreen ()
47
48=== modified file 'plugins/showmouse/src/showmouse.h'
49--- plugins/showmouse/src/showmouse.h 2016-05-31 17:30:42 +0000
50+++ plugins/showmouse/src/showmouse.h 2017-04-20 13:04:37 +0000
51@@ -140,6 +140,9 @@
52 MousePoller pollHandle;
53
54 void
55+ startupToggle ();
56+
57+ void
58 preparePaint (int);
59
60 bool

Subscribers

People subscribed via source and target branches