Merge lp:~3v1n0/compiz-grid-plugin/oneiric.fix_891886 into lp:~compiz-team/compiz-grid-plugin/oneiric

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 94
Merged at revision: 96
Proposed branch: lp:~3v1n0/compiz-grid-plugin/oneiric.fix_891886
Merge into: lp:~compiz-team/compiz-grid-plugin/oneiric
Diff against target: 207 lines (+142/-4)
6 files modified
CMakeLists.txt (+2/-0)
src/grabhandler.cpp (+47/-0)
src/grabhandler.h (+31/-0)
src/grid.cpp (+6/-4)
tests/grabhandler/CMakeLists.txt (+9/-0)
tests/grabhandler/test-grid-grab-handler.cpp (+47/-0)
To merge this branch: bzr merge lp:~3v1n0/compiz-grid-plugin/oneiric.fix_891886
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
Review via email: mp+82794@code.launchpad.net

Description of the change

This branch fixes the issue causing the grid plugin to be fired on window resize introduced by the branch lp:~smspillaz/compiz-grid-plugin/oneiric.fix_750316 .

I've added an extra check to see if we're not resizing, however just using the check

   if (mask & CompWindowGrabMoveMask)

seems to do the trick as well, but I'm not totally sure that this won't interfere with the multitouch issue related to bug #750316, also if using the three-fingers move in my notebook seems to work fine.

So, if anyone can re-test both the fixes...

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Hi Marco,

Can you confirm that the testcase here would be that resizing a window to the corner *wont* show the grid overlay ?

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

Yes, I confirm. The same should happen when resizing a window grabbing the top edge near to the panel.

94. By Marco Trevisan (Treviño)

Merged Sam's branch, which includes a test

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

Approved, works with tests, works with multitouch

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-09-29 11:18:56 +0000
+++ CMakeLists.txt 2011-11-22 00:00:28 +0000
@@ -5,3 +5,5 @@
5set (CMAKE_CXX_FLAGS -std=c++0x)5set (CMAKE_CXX_FLAGS -std=c++0x)
66
7compiz_plugin(grid PLUGINDEPS composite opengl)7compiz_plugin(grid PLUGINDEPS composite opengl)
8
9add_subdirectory (tests/grabhandler)
810
=== added file 'src/grabhandler.cpp'
--- src/grabhandler.cpp 1970-01-01 00:00:00 +0000
+++ src/grabhandler.cpp 2011-11-22 00:00:28 +0000
@@ -0,0 +1,47 @@
1/*
2 * Compiz Fusion Grid plugin
3 *
4 * Copyright (c) 2008 Stephen Kennedy <suasol@gmail.com>
5 * Copyright (c) 2010 Scott Moreau <oreaus@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * Description:
18 *
19 * Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
20 * use <Control><Alt>NUMPAD_KEY to move and tile your windows.
21 *
22 * Press the tiling keys several times to cycle through some tiling options.
23 */
24
25#include "grabhandler.h"
26
27compiz::grid::window::GrabWindowHandler::GrabWindowHandler (unsigned int mask) :
28 mMask (mask)
29{
30}
31
32compiz::grid::window::GrabWindowHandler::~GrabWindowHandler ()
33{
34}
35
36bool
37compiz::grid::window::GrabWindowHandler::track ()
38{
39 return ((mMask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask)) &&
40 !(mMask & CompWindowGrabResizeMask));
41}
42
43bool
44compiz::grid::window::GrabWindowHandler::resetResize ()
45{
46 return (mMask & CompWindowGrabResizeMask);
47}
048
=== added file 'src/grabhandler.h'
--- src/grabhandler.h 1970-01-01 00:00:00 +0000
+++ src/grabhandler.h 2011-11-22 00:00:28 +0000
@@ -0,0 +1,31 @@
1#define CompWindowGrabKeyMask (1 << 0)
2#define CompWindowGrabButtonMask (1 << 1)
3#define CompWindowGrabMoveMask (1 << 2)
4#define CompWindowGrabResizeMask (1 << 3)
5#define CompWindowGrabExternalAppMask (1 << 4)
6
7namespace compiz
8{
9namespace grid
10{
11namespace window
12{
13
14class GrabWindowHandler
15{
16 public:
17
18 GrabWindowHandler (unsigned int mask);
19 ~GrabWindowHandler ();
20
21 bool track ();
22 bool resetResize ();
23
24 private:
25
26 unsigned int mMask;
27
28};
29}
30}
31}
032
=== modified file 'src/grid.cpp'
--- src/grid.cpp 2011-10-05 17:41:22 +0000
+++ src/grid.cpp 2011-11-22 00:00:28 +0000
@@ -23,6 +23,7 @@
23 */23 */
2424
25#include "grid.h"25#include "grid.h"
26#include "grabhandler.h"
2627
27using namespace GridWindowType;28using namespace GridWindowType;
2829
@@ -766,7 +767,9 @@
766 unsigned int state,767 unsigned int state,
767 unsigned int mask)768 unsigned int mask)
768{769{
769 if (mask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask))770 compiz::grid::window::GrabWindowHandler gwHandler (mask);
771
772 if (gwHandler.track ())
770 {773 {
771 gScreen->o[0].value ().set ((int) window->id ());774 gScreen->o[0].value ().set ((int) window->id ());
772775
@@ -780,8 +783,7 @@
780 originalSize = gScreen->slotToRect(window,783 originalSize = gScreen->slotToRect(window,
781 window->serverBorderRect ());784 window->serverBorderRect ());
782 }785 }
783786 else if (gwHandler.resetResize ())
784 if (mask & CompWindowGrabResizeMask)
785 {787 {
786 isGridResized = false;788 isGridResized = false;
787 resizeCount = 0;789 resizeCount = 0;
@@ -1018,7 +1020,7 @@
1018 gridProps[GridRight] = GridProps {1,0, 2,1};1020 gridProps[GridRight] = GridProps {1,0, 2,1};
1019 gridProps[GridTopLeft] = GridProps{0,0, 2,2};1021 gridProps[GridTopLeft] = GridProps{0,0, 2,2};
1020 gridProps[GridTop] = GridProps {0,0, 1,2};1022 gridProps[GridTop] = GridProps {0,0, 1,2};
1021 gridProps[GridTopRight] = GridProps {0,0, 1,2};1023 gridProps[GridTopRight] = GridProps {1,0, 2,2};
1022 gridProps[GridMaximize] = GridProps {0,0, 1,1};1024 gridProps[GridMaximize] = GridProps {0,0, 1,1};
10231025
1024 animations.clear ();1026 animations.clear ();
10251027
=== added directory 'tests'
=== added directory 'tests/grabhandler'
=== added file 'tests/grabhandler/CMakeLists.txt'
--- tests/grabhandler/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/grabhandler/CMakeLists.txt 2011-11-22 00:00:28 +0000
@@ -0,0 +1,9 @@
1include_directories (${compiz_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src)
2
3add_executable (test-grid-grab-handler
4 test-grid-grab-handler.cpp
5 ../../src/grabhandler.cpp)
6
7target_link_libraries (test-grid-grab-handler pthread dl)
8
9add_test (test-grid-grab-handler-test test-grid-grab-handler)
010
=== added file 'tests/grabhandler/test-grid-grab-handler.cpp'
--- tests/grabhandler/test-grid-grab-handler.cpp 1970-01-01 00:00:00 +0000
+++ tests/grabhandler/test-grid-grab-handler.cpp 2011-11-22 00:00:28 +0000
@@ -0,0 +1,47 @@
1#include <stdlib.h>
2#include <iostream>
3#include <string>
4#include <grabhandler.h>
5
6/* FIXME: Not entirely portable, but we can't
7 * include window.h without pulling in bunch of
8 * static initalizers */
9
10#define CompWindowGrabKeyMask (1 << 0)
11#define CompWindowGrabButtonMask (1 << 1)
12#define CompWindowGrabMoveMask (1 << 2)
13#define CompWindowGrabResizeMask (1 << 3)
14#define CompWindowGrabExternalAppMask (1 << 4)
15
16void pass (const std::string &message)
17{
18 std::cout << "PASS: " << message << std::endl;
19}
20
21void fail (const std::string &message)
22{
23 std::cout << "FAIL: " << message << std::endl;
24 exit (1);
25}
26
27int main (void)
28{
29 compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
30 CompWindowGrabButtonMask);
31 compiz::grid::window::GrabWindowHandler resizeHandler (CompWindowGrabButtonMask |
32 CompWindowGrabResizeMask);
33
34 std::cout << "TEST: compiz::grid::window::GrabHandler" << std::endl;
35
36 if (moveHandler.track () && !moveHandler.resetResize ())
37 pass ("compiz::grid::window::GrabHandler CompWindowGrabMoveMask | CompWindowGrabButtonMask");
38 else
39 fail ("compiz::grid::window::GrabHandler CompWindowGrabMoveMask | CompWindowGrabButtonMask");
40
41 if (!resizeHandler.track () && resizeHandler.resetResize ())
42 pass ("compiz::grid::window::GrabHandler CompWindowGrabResizeMask | CompWindowGrabButtonMask");
43 else
44 fail ("compiz::grid::window::GrabHandler CompWindowGrabResizeMask | CompWindowGrabButtonMask");
45
46 return 0;
47}

Subscribers

People subscribed via source and target branches