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
CMakeLists.txt (+1/-1)
services/panel-service.c (+10/-4)
src/PanelTray.cpp (+24/-27)
src/PanelTray.h (+1/-3)
src/PanelView.cpp (+0/-6)
src/PanelView.h (+0/-2)
tests/CMakeLists.txt (+2/-2)
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-06-17 11:04:33 +0000
+++ CMakeLists.txt 2011-06-17 11:04:34 +0000
@@ -126,7 +126,7 @@
126#126#
127# src (Compiz Plugin)127# src (Compiz Plugin)
128#128#
129set (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")129set (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")
130130
131find_package (Compiz REQUIRED)131find_package (Compiz REQUIRED)
132include (CompizPlugin)132include (CompizPlugin)
133133
=== modified file 'services/panel-service.c'
--- services/panel-service.c 2011-04-10 23:51:05 +0000
+++ services/panel-service.c 2011-06-17 11:04:34 +0000
@@ -222,12 +222,14 @@
222222
223 if (e->type == 5 && self->priv->last_menu_button != 0) //FocusChange223 if (e->type == 5 && self->priv->last_menu_button != 0) //FocusChange
224 {224 {
225 gint x=0, y=0, width=0, height=0, depth=0, x_root=0, y_root=0;225 gint x=0, y=0, width=0, height=0, x_root=0, y_root=0;
226 GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (self->priv->last_menu));226 GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (self->priv->last_menu));
227 if (window == NULL)227 if (window == NULL)
228 return GDK_FILTER_CONTINUE;228 return GDK_FILTER_CONTINUE;
229229
230 Window xwindow = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));230 //FIXME-GTK3 - is this compatible? drawable is gone from gdk3
231 Window xwindow = gdk_x11_window_get_xid (window);
232 //Window xwindow = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
231233
232 if (xwindow == 0)234 if (xwindow == 0)
233 return GDK_FILTER_CONTINUE;235 return GDK_FILTER_CONTINUE;
@@ -246,7 +248,7 @@
246 &win_y,248 &win_y,
247 &mask_return);249 &mask_return);
248250
249 gdk_window_get_geometry (window, &x, &y, &width, &height, &depth);251 gdk_window_get_geometry (window, &x, &y, &width, &height);
250 gdk_window_get_origin (window, &x, &y);252 gdk_window_get_origin (window, &x, &y);
251253
252 if (x_root > x254 if (x_root > x
@@ -268,6 +270,8 @@
268 // ITS A WORKAROUND SO I CAN TEST THE PANEL SCRUBBING270 // ITS A WORKAROUND SO I CAN TEST THE PANEL SCRUBBING
269 // DONT HATE ME271 // DONT HATE ME
270 // --------------------------------------------------------------------------272 // --------------------------------------------------------------------------
273 //FIXME-GTK3 - i'm not porting this, fix your code :P
274 /*
271 else if (e->type == 6)275 else if (e->type == 6)
272 {276 {
273 int x_root=0, y_root=0;277 int x_root=0, y_root=0;
@@ -295,6 +299,8 @@
295 g_signal_emit (self, _service_signals[ACTIVE_MENU_POINTER_MOTION], 0);299 g_signal_emit (self, _service_signals[ACTIVE_MENU_POINTER_MOTION], 0);
296 }300 }
297 }301 }
302 */
303 // -> I HATE YOU
298 // /DONT HATE ME304 // /DONT HATE ME
299 // /FIXME305 // /FIXME
300 // --------------------------------------------------------------------------306 // --------------------------------------------------------------------------
301307
=== modified file 'src/PanelTray.cpp'
--- src/PanelTray.cpp 2011-06-17 11:04:33 +0000
+++ src/PanelTray.cpp 2011-06-17 11:04:34 +0000
@@ -44,20 +44,26 @@
44 SetMinMaxSize (1, 24);44 SetMinMaxSize (1, 24);
45 gtk_window_move (GTK_WINDOW (_window), 200, 12);45 gtk_window_move (GTK_WINDOW (_window), 200, 12);
46 gtk_widget_set_name (_window, "UnityPanelApplet");46 gtk_widget_set_name (_window, "UnityPanelApplet");
47 gtk_widget_set_colormap (_window, gdk_screen_get_rgba_colormap (gdk_screen_get_default ())); 47
48 //FIXME-GTK3 - can't set the colourmap anymore
49 //gtk_widget_set_colormap (_window, gdk_screen_get_rgba_colormap (gdk_screen_get_default ()));
48 gtk_widget_realize (_window);50 gtk_widget_realize (_window);
49 gdk_window_set_back_pixmap (gtk_widget_get_window(GTK_WIDGET(_window)), NULL, FALSE);51
52 //FIXME-GTK3 - is this compatible? not entirely sure, *should* be
53 gdk_window_set_background_pattern (gtk_widget_get_window(GTK_WIDGET(_window)), NULL);
54 //gdk_window_set_back_pixmap (gtk_widget_get_window(GTK_WIDGET(_window)), NULL, FALSE);
55
50 gtk_widget_set_app_paintable (_window, TRUE);56 gtk_widget_set_app_paintable (_window, TRUE);
51 _tray_expose_id = g_signal_connect (_window, "expose-event", G_CALLBACK (PanelTray::OnTrayExpose), this);57 _tray_expose_id = g_signal_connect (_window, "draw", G_CALLBACK (PanelTray::OnTrayDraw), this);
5258
53 if (!g_getenv ("UNITY_PANEL_TRAY_DISABLE"))59 if (!g_getenv ("UNITY_PANEL_TRAY_DISABLE"))
54 {60 {
55 _tray = na_tray_new_for_screen (gdk_screen_get_default (),61 _tray = na_tray_new_for_screen (gdk_screen_get_default (),
56 GTK_ORIENTATION_HORIZONTAL,62 GTK_ORIENTATION_HORIZONTAL);
57 (NaTrayFilterCallback)FilterTrayCallback,63
58 this);64 // FIXME-GTK3 - na_tray_get_manager no longer exists - we could easily add it though i guess
59 _tray_icon_added_id = g_signal_connect (na_tray_get_manager (_tray), "tray_icon_removed",65 //_tray_icon_added_id = g_signal_connect (na_tray_get_manager (_tray), "tray_icon_removed",
60 G_CALLBACK (PanelTray::OnTrayIconRemoved), this);66 // G_CALLBACK (PanelTray::OnTrayIconRemoved), this);
6167
62 gtk_container_add (GTK_CONTAINER (_window), GTK_WIDGET (_tray));68 gtk_container_add (GTK_CONTAINER (_window), GTK_WIDGET (_tray));
63 gtk_widget_show (GTK_WIDGET (_tray));69 gtk_widget_show (GTK_WIDGET (_tray));
@@ -66,11 +72,11 @@
6672
67PanelTray::~PanelTray ()73PanelTray::~PanelTray ()
68{74{
69 if (_tray)75 //if (_tray)
70 {76 //{
71 g_signal_handler_disconnect (na_tray_get_manager (_tray), _tray_icon_added_id);77 // g_signal_handler_disconnect (na_tray_get_manager (_tray), _tray_icon_added_id);
72 _tray = NULL;78 // _tray = NULL;
73 }79 //}
7480
75 g_idle_remove_by_data (this);81 g_idle_remove_by_data (this);
76 82
@@ -96,12 +102,6 @@
96 }102 }
97}103}
98104
99Window
100PanelTray::GetTrayWindow ()
101{
102 return GDK_WINDOW_XWINDOW (gtk_widget_get_window(GTK_WIDGET(_window)));
103}
104
105void105void
106PanelTray::Sync ()106PanelTray::Sync ()
107{107{
@@ -192,14 +192,13 @@
192}192}
193193
194gboolean194gboolean
195PanelTray::OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray)195PanelTray::OnTrayDraw (GtkWidget *widget, cairo_t *cr, PanelTray *tray)
196{196{
197 cairo_t *cr = gdk_cairo_create (gtk_widget_get_window(GTK_WIDGET(widget)));
198 GtkAllocation alloc;197 GtkAllocation alloc;
199198
200 gtk_widget_get_allocation (widget, &alloc);199 gtk_widget_get_allocation (widget, &alloc);
201200
202 gdk_cairo_region (cr, ev->region);201 //gdk_cairo_region (cr, ev->region);
203 cairo_clip (cr);202 cairo_clip (cr);
204203
205 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);204 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
@@ -210,11 +209,9 @@
210 cairo_rectangle (cr, 0, 0, alloc.width, alloc.height);209 cairo_rectangle (cr, 0, 0, alloc.width, alloc.height);
211 cairo_fill (cr);210 cairo_fill (cr);
212211
213 cairo_destroy (cr);212 gtk_container_propagate_draw (GTK_CONTAINER (widget),
214213 gtk_bin_get_child (GTK_BIN (widget)),
215 gtk_container_propagate_expose (GTK_CONTAINER (widget),214 cr);
216 gtk_bin_get_child (GTK_BIN (widget)),
217 ev);
218215
219 return FALSE;216 return FALSE;
220}217}
221218
=== modified file 'src/PanelTray.h'
--- src/PanelTray.h 2011-06-09 16:08:05 +0000
+++ src/PanelTray.h 2011-06-17 11:04:34 +0000
@@ -45,8 +45,6 @@
4545
46 void Draw (nux::GraphicsEngine& gfx_content, bool force_draw);46 void Draw (nux::GraphicsEngine& gfx_content, bool force_draw);
4747
48 Window GetTrayWindow ();
49
50 void Sync ();48 void Sync ();
5149
52 virtual void OnEntryAdded(unity::indicator::Entry::Ptr const& proxy);50 virtual void OnEntryAdded(unity::indicator::Entry::Ptr const& proxy);
@@ -63,7 +61,7 @@
63 static gboolean FilterTrayCallback (NaTray *tray, NaTrayChild *child, PanelTray *self);61 static gboolean FilterTrayCallback (NaTray *tray, NaTrayChild *child, PanelTray *self);
64 static void OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self);62 static void OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self);
65 static gboolean IdleSync (PanelTray *tray);63 static gboolean IdleSync (PanelTray *tray);
66 static gboolean OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray);64 static gboolean OnTrayDraw (GtkWidget *widget, cairo_t *cr, PanelTray *tray);
6765
68private:66private:
69 GSettings *_settings;67 GSettings *_settings;
7068
=== modified file 'src/PanelView.cpp'
--- src/PanelView.cpp 2011-06-02 08:37:18 +0000
+++ src/PanelView.cpp 2011-06-17 11:04:34 +0000
@@ -327,12 +327,6 @@
327 }327 }
328}328}
329329
330Window
331PanelView::GetTrayWindow ()
332{
333 return _tray->GetTrayWindow ();
334}
335
336void330void
337PanelView::SetOpacity (float opacity)331PanelView::SetOpacity (float opacity)
338{332{
339333
=== modified file 'src/PanelView.h'
--- src/PanelView.h 2011-05-30 02:49:31 +0000
+++ src/PanelView.h 2011-06-17 11:04:34 +0000
@@ -66,8 +66,6 @@
66 void StartFirstMenuShow ();66 void StartFirstMenuShow ();
67 void EndFirstMenuShow ();67 void EndFirstMenuShow ();
6868
69 Window GetTrayWindow ();
70
71 void SetOpacity (float opacity);69 void SetOpacity (float opacity);
7270
73protected:71protected:
7472
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2011-06-02 23:26:49 +0000
+++ tests/CMakeLists.txt 2011-06-17 11:04:34 +0000
@@ -7,8 +7,8 @@
7# Unit tests7# Unit tests
8#8#
9find_package (PkgConfig)9find_package (PkgConfig)
10set (TEST_DEPS "${UNITY_PLUGIN_DEPS};indicator")10set (TEST_DEPS "${UNITY_PLUGIN_DEPS};indicator3")
11pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS} indicator)11pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS} indicator3)
1212
13set (CFLAGS13set (CFLAGS
14 ${TEST_UNIT_DEPS_CFLAGS}14 ${TEST_UNIT_DEPS_CFLAGS}