Merge lp:~cando/unity/fix_703411 into lp:unity

Proposed by Stefano Candori
Status: Merged
Approved by: Alex Launi
Approved revision: no longer in the source branch.
Merged at revision: 832
Proposed branch: lp:~cando/unity/fix_703411
Merge into: lp:unity
Diff against target: 135 lines (+41/-0)
8 files modified
src/PanelMenuView.cpp (+14/-0)
src/PanelMenuView.h (+1/-0)
src/PanelTitlebarGrabAreaView.cpp (+6/-0)
src/PanelTitlebarGrabAreaView.h (+1/-0)
src/PluginAdapter.cpp (+11/-0)
src/PluginAdapter.h (+1/-0)
src/WindowManager.cpp (+5/-0)
src/WindowManager.h (+2/-0)
To merge this branch: bzr merge lp:~cando/unity/fix_703411
Reviewer Review Type Date Requested Status
Loïc Molinari (community) Approve
Review via email: mp+48921@code.launchpad.net

Description of the change

In this branch i've fixed the bug #703411.
I've simply exposed the CompWindow->lower() event into the PluginAdapter class. This method is called when the user clicks with the middle button of the mouse on the PanelTitleBarArea.

To post a comment you must log in.
Revision history for this message
Loïc Molinari (loic.molinari) wrote :

Nice job.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PanelMenuView.cpp'
2--- src/PanelMenuView.cpp 2011-02-01 17:33:26 +0000
3+++ src/PanelMenuView.cpp 2011-02-08 14:28:12 +0000
4@@ -85,6 +85,7 @@
5 _panel_titlebar_grab_area = new PanelTitlebarGrabArea ();
6 _panel_titlebar_grab_area->mouse_down.connect (sigc::mem_fun (this, &PanelMenuView::OnMaximizedGrab));
7 _panel_titlebar_grab_area->mouse_doubleclick.connect (sigc::mem_fun (this, &PanelMenuView::OnRestoreClicked));
8+ _panel_titlebar_grab_area->mouse_middleclick.connect (sigc::mem_fun (this, &PanelMenuView::OnMouseMiddleClicked));
9
10 win_manager = WindowManager::Default ();
11
12@@ -766,6 +767,19 @@
13 }
14 }
15
16+void
17+PanelMenuView::OnMouseMiddleClicked ()
18+{
19+ if (_is_maximized)
20+ {
21+ BamfWindow *window;
22+
23+ window = bamf_matcher_get_active_window (_matcher);
24+ if (BAMF_IS_WINDOW (window))
25+ WindowManager::Default ()->Lower (bamf_window_get_xid (window));
26+ }
27+}
28+
29 // Introspectable
30 const gchar *
31 PanelMenuView::GetName ()
32
33=== modified file 'src/PanelMenuView.h'
34--- src/PanelMenuView.h 2011-01-26 17:45:58 +0000
35+++ src/PanelMenuView.h 2011-02-08 14:28:12 +0000
36@@ -76,6 +76,7 @@
37 void OnWindowRestored (guint32 xid);
38
39 void OnMaximizedGrab (int x, int y);
40+ void OnMouseMiddleClicked ();
41
42 void Refresh ();
43 void AllMenusClosed ();
44
45=== modified file 'src/PanelTitlebarGrabAreaView.cpp'
46--- src/PanelTitlebarGrabAreaView.cpp 2011-01-26 14:15:47 +0000
47+++ src/PanelTitlebarGrabAreaView.cpp 2011-02-08 14:28:12 +0000
48@@ -63,6 +63,12 @@
49
50 void PanelTitlebarGrabArea::RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags)
51 {
52+ int button = nux::GetEventButton (button_flags);
53+ if (button == 2)
54+ {
55+ mouse_middleclick.emit ();
56+ return;
57+ }
58 mouse_down.emit (x, y);
59 }
60
61
62=== modified file 'src/PanelTitlebarGrabAreaView.h'
63--- src/PanelTitlebarGrabAreaView.h 2011-01-26 14:15:47 +0000
64+++ src/PanelTitlebarGrabAreaView.h 2011-02-08 14:28:12 +0000
65@@ -39,6 +39,7 @@
66 ~PanelTitlebarGrabArea ();
67
68 sigc::signal <void, int, int> mouse_down;
69+ sigc::signal <void> mouse_middleclick;
70 sigc::signal <void> mouse_doubleclick;
71
72 protected:
73
74=== modified file 'src/PluginAdapter.cpp'
75--- src/PluginAdapter.cpp 2011-01-31 13:55:03 +0000
76+++ src/PluginAdapter.cpp 2011-02-08 14:28:12 +0000
77@@ -352,6 +352,17 @@
78 window->close (CurrentTime);
79 }
80
81+void
82+PluginAdapter::Lower (guint32 xid)
83+{
84+ Window win = (Window)xid;
85+ CompWindow *window;
86+
87+ window = m_Screen->findWindow (win);
88+ if (window)
89+ window->lower ();
90+}
91+
92 void PluginAdapter::MaximizeIfBigEnough (CompWindow *window)
93 {
94 XClassHint classHint;
95
96=== modified file 'src/PluginAdapter.h'
97--- src/PluginAdapter.h 2011-01-27 15:48:47 +0000
98+++ src/PluginAdapter.h 2011-02-08 14:28:12 +0000
99@@ -81,6 +81,7 @@
100 void Restore (guint32 xid);
101 void Minimize (guint32 xid);
102 void Close (guint32 xid);
103+ void Lower (guint32 xid);
104
105 void MaximizeIfBigEnough (CompWindow *window);
106
107
108=== modified file 'src/WindowManager.cpp'
109--- src/WindowManager.cpp 2011-01-14 18:17:34 +0000
110+++ src/WindowManager.cpp 2011-02-08 14:28:12 +0000
111@@ -62,6 +62,11 @@
112 {
113 g_debug ("%s", G_STRFUNC);
114 }
115+
116+ void Lower (guint32 xid)
117+ {
118+ g_debug ("%s", G_STRFUNC);
119+ }
120 };
121
122 WindowManager *
123
124=== modified file 'src/WindowManager.h'
125--- src/WindowManager.h 2011-01-14 18:17:34 +0000
126+++ src/WindowManager.h 2011-02-08 14:28:12 +0000
127@@ -53,6 +53,8 @@
128 virtual void Restore (guint32 xid) = 0;
129 virtual void Minimize (guint32 xid) = 0;
130 virtual void Close (guint32 xid) = 0;
131+
132+ virtual void Lower (guint32 xid) = 0;
133
134 virtual void Decorate (guint32 xid);
135 virtual void Undecorate (guint32 xid);