Merge lp:~gordallott/unity/unity-gtk3 into lp:unity

Proposed by Gord Allott on 2011-06-17
Status: Merged
Approved by: Neil J. Patel on 2011-06-17
Approved revision: 1191
Merged at revision: 1242
Proposed branch: lp:~gordallott/unity/unity-gtk3
Merge into: lp:unity
Prerequisite: lp:~bilalakhtar/unity/port-to-gtk3
Diff against target: 229 lines (+38/-45) 7 files modified
To merge this branch: bzr merge lp:~gordallott/unity/unity-gtk3
Reviewer Review Type Date Requested Status
Neil J. Patel (community) 2011-06-17 Approve on 2011-06-17
Review via email: mp+64967@code.launchpad.net

Description of the Change

port to gtk3, based on lp:~bilalakhtar/unity/port-to-gtk3 - will require that to be merged in first for the kudos,

needs trunk bamf (for updated wnck), needs updated libunity-misc (https://code.launchpad.net/~gordallott/libunity-misc/port-to-gdk3-gtk3/+merge/64820) - indicator3 - gtk3, gdk3, everything3

breaks notification-area, added FIXME-GTK tag to the code that i changed that affects notification-area

To post a comment you must log in.
Neil J. Patel (njpatel) wrote :

I'll merge it with my changes.

review: Approve

Preview Diff

1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2011-06-17 11:04:33 +0000
3+++ CMakeLists.txt 2011-06-17 11:04:34 +0000
4@@ -126,7 +126,7 @@
5 #
6 # src (Compiz Plugin)
7 #
8-set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator;atk;unity-misc;gconf-2.0;libutouch-geis;gtk+-3.0")
9+set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3;atk;unity-misc;gconf-2.0;libutouch-geis;gtk+-3.0")
10
11 find_package (Compiz REQUIRED)
12 include (CompizPlugin)
13
14=== modified file 'services/panel-service.c'
15--- services/panel-service.c 2011-04-10 23:51:05 +0000
16+++ services/panel-service.c 2011-06-17 11:04:34 +0000
17@@ -222,12 +222,14 @@
18
19 if (e->type == 5 && self->priv->last_menu_button != 0) //FocusChange
20 {
21- gint x=0, y=0, width=0, height=0, depth=0, x_root=0, y_root=0;
22+ gint x=0, y=0, width=0, height=0, x_root=0, y_root=0;
23 GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (self->priv->last_menu));
24 if (window == NULL)
25 return GDK_FILTER_CONTINUE;
26-
27- Window xwindow = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
28+
29+ //FIXME-GTK3 - is this compatible? drawable is gone from gdk3
30+ Window xwindow = gdk_x11_window_get_xid (window);
31+ //Window xwindow = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
32
33 if (xwindow == 0)
34 return GDK_FILTER_CONTINUE;
35@@ -246,7 +248,7 @@
36 &win_y,
37 &mask_return);
38
39- gdk_window_get_geometry (window, &x, &y, &width, &height, &depth);
40+ gdk_window_get_geometry (window, &x, &y, &width, &height);
41 gdk_window_get_origin (window, &x, &y);
42
43 if (x_root > x
44@@ -268,6 +270,8 @@
45 // ITS A WORKAROUND SO I CAN TEST THE PANEL SCRUBBING
46 // DONT HATE ME
47 // --------------------------------------------------------------------------
48+ //FIXME-GTK3 - i'm not porting this, fix your code :P
49+ /*
50 else if (e->type == 6)
51 {
52 int x_root=0, y_root=0;
53@@ -295,6 +299,8 @@
54 g_signal_emit (self, _service_signals[ACTIVE_MENU_POINTER_MOTION], 0);
55 }
56 }
57+ */
58+ // -> I HATE YOU
59 // /DONT HATE ME
60 // /FIXME
61 // --------------------------------------------------------------------------
62
63=== modified file 'src/PanelTray.cpp'
64--- src/PanelTray.cpp 2011-06-17 11:04:33 +0000
65+++ src/PanelTray.cpp 2011-06-17 11:04:34 +0000
66@@ -44,20 +44,26 @@
67 SetMinMaxSize (1, 24);
68 gtk_window_move (GTK_WINDOW (_window), 200, 12);
69 gtk_widget_set_name (_window, "UnityPanelApplet");
70- gtk_widget_set_colormap (_window, gdk_screen_get_rgba_colormap (gdk_screen_get_default ()));
71+
72+ //FIXME-GTK3 - can't set the colourmap anymore
73+ //gtk_widget_set_colormap (_window, gdk_screen_get_rgba_colormap (gdk_screen_get_default ()));
74 gtk_widget_realize (_window);
75- gdk_window_set_back_pixmap (gtk_widget_get_window(GTK_WIDGET(_window)), NULL, FALSE);
76+
77+ //FIXME-GTK3 - is this compatible? not entirely sure, *should* be
78+ gdk_window_set_background_pattern (gtk_widget_get_window(GTK_WIDGET(_window)), NULL);
79+ //gdk_window_set_back_pixmap (gtk_widget_get_window(GTK_WIDGET(_window)), NULL, FALSE);
80+
81 gtk_widget_set_app_paintable (_window, TRUE);
82- _tray_expose_id = g_signal_connect (_window, "expose-event", G_CALLBACK (PanelTray::OnTrayExpose), this);
83+ _tray_expose_id = g_signal_connect (_window, "draw", G_CALLBACK (PanelTray::OnTrayDraw), this);
84
85 if (!g_getenv ("UNITY_PANEL_TRAY_DISABLE"))
86 {
87 _tray = na_tray_new_for_screen (gdk_screen_get_default (),
88- GTK_ORIENTATION_HORIZONTAL,
89- (NaTrayFilterCallback)FilterTrayCallback,
90- this);
91- _tray_icon_added_id = g_signal_connect (na_tray_get_manager (_tray), "tray_icon_removed",
92- G_CALLBACK (PanelTray::OnTrayIconRemoved), this);
93+ GTK_ORIENTATION_HORIZONTAL);
94+
95+ // FIXME-GTK3 - na_tray_get_manager no longer exists - we could easily add it though i guess
96+ //_tray_icon_added_id = g_signal_connect (na_tray_get_manager (_tray), "tray_icon_removed",
97+ // G_CALLBACK (PanelTray::OnTrayIconRemoved), this);
98
99 gtk_container_add (GTK_CONTAINER (_window), GTK_WIDGET (_tray));
100 gtk_widget_show (GTK_WIDGET (_tray));
101@@ -66,11 +72,11 @@
102
103 PanelTray::~PanelTray ()
104 {
105- if (_tray)
106- {
107- g_signal_handler_disconnect (na_tray_get_manager (_tray), _tray_icon_added_id);
108- _tray = NULL;
109- }
110+ //if (_tray)
111+ //{
112+ // g_signal_handler_disconnect (na_tray_get_manager (_tray), _tray_icon_added_id);
113+ // _tray = NULL;
114+ //}
115
116 g_idle_remove_by_data (this);
117
118@@ -96,12 +102,6 @@
119 }
120 }
121
122-Window
123-PanelTray::GetTrayWindow ()
124-{
125- return GDK_WINDOW_XWINDOW (gtk_widget_get_window(GTK_WIDGET(_window)));
126-}
127-
128 void
129 PanelTray::Sync ()
130 {
131@@ -192,14 +192,13 @@
132 }
133
134 gboolean
135-PanelTray::OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray)
136+PanelTray::OnTrayDraw (GtkWidget *widget, cairo_t *cr, PanelTray *tray)
137 {
138- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window(GTK_WIDGET(widget)));
139 GtkAllocation alloc;
140
141 gtk_widget_get_allocation (widget, &alloc);
142
143- gdk_cairo_region (cr, ev->region);
144+ //gdk_cairo_region (cr, ev->region);
145 cairo_clip (cr);
146
147 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
148@@ -210,11 +209,9 @@
149 cairo_rectangle (cr, 0, 0, alloc.width, alloc.height);
150 cairo_fill (cr);
151
152- cairo_destroy (cr);
153-
154- gtk_container_propagate_expose (GTK_CONTAINER (widget),
155- gtk_bin_get_child (GTK_BIN (widget)),
156- ev);
157+ gtk_container_propagate_draw (GTK_CONTAINER (widget),
158+ gtk_bin_get_child (GTK_BIN (widget)),
159+ cr);
160
161 return FALSE;
162 }
163
164=== modified file 'src/PanelTray.h'
165--- src/PanelTray.h 2011-06-09 16:08:05 +0000
166+++ src/PanelTray.h 2011-06-17 11:04:34 +0000
167@@ -45,8 +45,6 @@
168
169 void Draw (nux::GraphicsEngine& gfx_content, bool force_draw);
170
171- Window GetTrayWindow ();
172-
173 void Sync ();
174
175 virtual void OnEntryAdded(unity::indicator::Entry::Ptr const& proxy);
176@@ -63,7 +61,7 @@
177 static gboolean FilterTrayCallback (NaTray *tray, NaTrayChild *child, PanelTray *self);
178 static void OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self);
179 static gboolean IdleSync (PanelTray *tray);
180- static gboolean OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray);
181+ static gboolean OnTrayDraw (GtkWidget *widget, cairo_t *cr, PanelTray *tray);
182
183 private:
184 GSettings *_settings;
185
186=== modified file 'src/PanelView.cpp'
187--- src/PanelView.cpp 2011-06-02 08:37:18 +0000
188+++ src/PanelView.cpp 2011-06-17 11:04:34 +0000
189@@ -327,12 +327,6 @@
190 }
191 }
192
193-Window
194-PanelView::GetTrayWindow ()
195-{
196- return _tray->GetTrayWindow ();
197-}
198-
199 void
200 PanelView::SetOpacity (float opacity)
201 {
202
203=== modified file 'src/PanelView.h'
204--- src/PanelView.h 2011-05-30 02:49:31 +0000
205+++ src/PanelView.h 2011-06-17 11:04:34 +0000
206@@ -66,8 +66,6 @@
207 void StartFirstMenuShow ();
208 void EndFirstMenuShow ();
209
210- Window GetTrayWindow ();
211-
212 void SetOpacity (float opacity);
213
214 protected:
215
216=== modified file 'tests/CMakeLists.txt'
217--- tests/CMakeLists.txt 2011-06-02 23:26:49 +0000
218+++ tests/CMakeLists.txt 2011-06-17 11:04:34 +0000
219@@ -7,8 +7,8 @@
220 # Unit tests
221 #
222 find_package (PkgConfig)
223-set (TEST_DEPS "${UNITY_PLUGIN_DEPS};indicator")
224-pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS} indicator)
225+set (TEST_DEPS "${UNITY_PLUGIN_DEPS};indicator3")
226+pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS} indicator3)
227
228 set (CFLAGS
229 ${TEST_UNIT_DEPS_CFLAGS}