Merge lp:~sjakthol/compiz/fix-1066187 into lp:compiz/0.9.9

Proposed by Sami Jaktholm
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3416
Merged at revision: 3419
Proposed branch: lp:~sjakthol/compiz/fix-1066187
Merge into: lp:compiz/0.9.9
Diff against target: 84 lines (+30/-7)
2 files modified
plugins/ezoom/src/ezoom.cpp (+22/-6)
plugins/ezoom/src/ezoom.h (+8/-1)
To merge this branch: bzr merge lp:~sjakthol/compiz/fix-1066187
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
MC Return Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+129556@code.launchpad.net

Commit message

Problem:
Specific Zoom Factor settings were ignored by the Enhanced Zoom Desktop
(LP: #1066187) because the values were only read once during initial load of
the plugin probably before the user defined configuration was read (and thus
it always used the default values).

Fix:
Instead of sending the (original) value of the initiated zoom level, send a
zoom level identifier. The identifier is used to determine which zoom level
the user wants and a fresh setting for that zoom level is used.

.

Description of the change

Tested the changes locally and they seem to compile and work fine. Please let me know if there's any problems with the coding style or implementation and I'll try to fix them.

Test case:
1. Open CCSM
2. Choose 'Enhanced Zoom Desktop' plugin (and make sure it's in use)
3. Go to 'Specific Zoom' tab
4. Add key bindings for Specific Zoom Level 1, 2 and 3
5. Set same values to Specific Zoom factor 2 and 3 (e.g. 0.7)
6. Press the key binding for Specific Zoom Level 2
7. Press the key binding for Specific Zoom Level 3
8. Change the zoom factors and test what happens by pressing the corresponding key bindings

You might want to keep the factor 1 at 1.00 so that you can reset the zoom once done.

Current behavior:
At (6) the screen gets zoomed in (like it should) but at (7) screen is zoomed even more (incorrect behavior, the values were the same). At (8) you'll see how the zoom for a certain level (factor 1 = 1.00, factor 2 = 0.5, factor 3 = 0.2) is always the same no matter what your input is.

Behavior with the fix:
At (6) the screen gets zoomed in (like it should) and at (7) nothing happens (correct behavior as the zoom factors were the same). At (8) the zoom clearly depends on the values you specified.

Possible problems:
Not sure if this is possible but if something outside ezoom plugin is directly calling EZoomScreen::zoomSpecific they will be broken as the input variable type of the target changed.

To post a comment you must log in.
Revision history for this message
MC Return (mc-return) wrote :

sampo555, great :)
Thanks a lot for your fix. I have yet to test it until I can approve it, but looks quite ok to me.

Regarding coding style: Compiz uses C++11 coding style, mixing spaces with tabs.

The first indent are 4 spaces, then a tab 8 spaces wide, then a mix of a tab and 4 spaces.
If you intend to help more with Compiz coding and want to use QTCreator, I am sure we can share the QTC settings file with you to make it easier to follow this style.

Otherwise I can take over your branch and fix the indentation there, before we merge this.

Thanks a lot for your contribution - you are very welcome to eliminate more of those nasty small bugs ;).
(I'll try to test and approve your fix ASAP.)

Revision history for this message
MC Return (mc-return) wrote :

I have tested this fix now and can confirm that it works like intended. :)

Regarding possible problems: It seems no other plug-in in current trunk requires ezoom (<requirement>), also a search for EZoomScreen::zoomSpecific through the code did not find any results except the ones in plugins/ezoom/src/ezoom.cpp.

The only stopper before merge, that I can spot, is the wrong indentation.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Verified, the fix works.

Please just change the opening braces on lines 16 and 65 to match the Compiz convention. So:
    foo {
should be:
    foo
    {

review: Needs Fixing
lp:~sjakthol/compiz/fix-1066187 updated
3416. By Sami Jaktholm

Fix brackets.

Revision history for this message
Sami Jaktholm (sjakthol) wrote :

Fixed.

Revision history for this message
MC Return (mc-return) wrote :

LGTM.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/ezoom/src/ezoom.cpp'
--- plugins/ezoom/src/ezoom.cpp 2012-09-04 15:33:44 +0000
+++ plugins/ezoom/src/ezoom.cpp 2012-10-15 12:54:23 +0000
@@ -1544,17 +1544,33 @@
1544EZoomScreen::zoomSpecific (CompAction *action,1544EZoomScreen::zoomSpecific (CompAction *action,
1545 CompAction::State state,1545 CompAction::State state,
1546 CompOption::Vector options,1546 CompOption::Vector options,
1547 float target)1547 SpecificZoomTarget target)
1548{1548{
1549 int out = screen->outputDeviceForPoint (pointerX, pointerY);1549 int out = screen->outputDeviceForPoint (pointerX, pointerY);
1550 float zoom_level;
1550 CompWindow *w;1551 CompWindow *w;
15511552
1552 if (target == 1.0f && zooms.at (out).newZoom == 1.0f)1553 switch (target)
1554 {
1555 case ZoomTargetFirst:
1556 zoom_level = optionGetZoomSpec1 ();
1557 break;
1558 case ZoomTargetSecond:
1559 zoom_level = optionGetZoomSpec2 ();
1560 break;
1561 case ZoomTargetThird:
1562 zoom_level = optionGetZoomSpec3 ();
1563 break;
1564 default:
1565 return false;
1566 }
1567
1568 if (zoom_level == 1.0f && zooms.at (out).newZoom == 1.0f)
1553 return false;1569 return false;
1554 if (screen->otherGrabExist (NULL))1570 if (screen->otherGrabExist (NULL))
1555 return false;1571 return false;
15561572
1557 setScale (out, target);1573 setScale (out, zoom_level);
15581574
1559 w = screen->findWindow (screen->activeWindow ());1575 w = screen->findWindow (screen->activeWindow ());
1560 if (optionGetSpecTargetFocus ()1576 if (optionGetSpecTargetFocus ()
@@ -1915,13 +1931,13 @@
19151931
1916 optionSetZoomSpecific1KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,1932 optionSetZoomSpecific1KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
1917 this, _1, _2, _3,1933 this, _1, _2, _3,
1918 optionGetZoomSpec1 ()));1934 ZoomTargetFirst));
1919 optionSetZoomSpecific2KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,1935 optionSetZoomSpecific2KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
1920 this, _1, _2, _3,1936 this, _1, _2, _3,
1921 optionGetZoomSpec2 ()));1937 ZoomTargetSecond));
1922 optionSetZoomSpecific3KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,1938 optionSetZoomSpecific3KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
1923 this, _1, _2, _3,1939 this, _1, _2, _3,
1924 optionGetZoomSpec3 ()));1940 ZoomTargetThird));
19251941
1926 optionSetPanLeftKeyInitiate (boost::bind (&EZoomScreen::zoomPan, this, _1,1942 optionSetPanLeftKeyInitiate (boost::bind (&EZoomScreen::zoomPan, this, _1,
1927 _2, _3, -1, 0));1943 _2, _3, -1, 0));
19281944
=== modified file 'plugins/ezoom/src/ezoom.h'
--- plugins/ezoom/src/ezoom.h 2012-09-04 15:33:44 +0000
+++ plugins/ezoom/src/ezoom.h 2012-10-15 12:54:23 +0000
@@ -49,6 +49,13 @@
4949
50#include <cmath>50#include <cmath>
5151
52enum SpecificZoomTarget
53{
54 ZoomTargetFirst = 0,
55 ZoomTargetSecond,
56 ZoomTargetThird
57};
58
52class EZoomScreen :59class EZoomScreen :
53 public PluginClassHandler <EZoomScreen, CompScreen>,60 public PluginClassHandler <EZoomScreen, CompScreen>,
54 public EzoomOptions,61 public EzoomOptions,
@@ -314,7 +321,7 @@
314 zoomSpecific (CompAction *action,321 zoomSpecific (CompAction *action,
315 CompAction::State state,322 CompAction::State state,
316 CompOption::Vector options,323 CompOption::Vector options,
317 float target);324 SpecificZoomTarget target);
318325
319 bool326 bool
320 zoomToWindow (CompAction *action,327 zoomToWindow (CompAction *action,

Subscribers

People subscribed via source and target branches