All of lore.kernel.org
 help / color / mirror / Atom feed
* [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3
@ 2016-05-03 11:30 Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 01/25] build: check for GTK+3, and require 3.0 Jussi Kukkonen
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

Apologies for one more patch bomb: This is an upgrade for
matchbox-panel-2 to use modern dependencies, mostly Gtk+3. Most
commits are again from Ross, I just fixed bugs and replaced some
deprecated code.


This patchset is part of the quest to make Sato compatible with GTK+3.
Complete WIP collection of patches can be found in jku/matchbox-wip
branch at git://git.yoctoproject.org/poky-contrib


  -Jussi

The following changes since commit a0b5fca04da208990f3c40e65dbb045da4cdb35e:

  showdesktop: Make sure active state is initialized (2016-03-21 11:27:08 +0000)

are available in the git repository at:

  git://github.com/jku/matchbox-panel-2 gtk3
  https://github.com/jku/matchbox-panel-2/tree/gtk3

Jussi Kukkonen (6):
  Fix a crash on startup
  Don't use deprecated GtkMisc
  Update .pc-file to require Gtk+-3.0
  Draw systray icons in their actual locations
  mb-panel: size request needs to be set before realize
  windowselector: Port to ScalingImage2

Ross Burton (19):
  build: check for GTK+3, and require 3.0
  windowselector: port to GTK+ 3
  startup: port to GTK+ 3
  startup-notify: port to GTK+ 3
  showdesktop: port to GTK+ 3
  launcher: port to GTK+ 3
  mb-panel: port to GTK+3
  notify: port to GTK+ 3
  systray: port to GTK+ 3
  data: ship our own icons here instead of in sato-icon-theme
  po: update POTFILES.in
  build: bump version to 2.9
  scaling-image: fix whitespace
  scaling-image: port to GTK+ 3 API
  mb-panel: allow resizing, but hide the grip
  mb-panel: replace --titlebar with --mode
  scaling-image2: revised and slimmer scaling image implementation
  applets: add scaling-image2 to the test harness
  showdesktop: port to use scaling-image2

 Makefile.am                              |   2 +-
 applets/Makefile.applets                 |   3 +-
 applets/launcher/launcher.c              |  12 +-
 applets/notify/applet.c                  |  19 +-
 applets/notify/mb-notification.c         |  40 +-
 applets/showdesktop/showdesktop.c        |  28 +-
 applets/startup-notify/startup.c         |  65 ++-
 applets/startup/startup.c                |  63 +--
 applets/systray/Makefile.am              |  20 +-
 applets/systray/fixedtip.c               | 275 ++++++++++
 applets/systray/fixedtip.h               |  68 +++
 applets/systray/na-marshal.list          |   3 -
 applets/systray/na-tray-child.c          | 526 +++++++++++++++++++
 applets/systray/na-tray-child.h          |  71 +++
 applets/systray/na-tray-manager.c        | 570 +++++++++++---------
 applets/systray/na-tray-manager.h        |  32 +-
 applets/systray/na-tray.c                | 865 +++++++++++++++++++++++++++++++
 applets/systray/na-tray.h                |  76 +++
 applets/systray/systray.c                |  91 +---
 applets/windowselector/windowselector.c  |  43 +-
 configure.ac                             |  11 +-
 data/16x16/panel-task-switcher.png       | Bin 0 -> 432 bytes
 data/16x16/panel-user-desktop.png        | Bin 0 -> 393 bytes
 data/22x22/panel-task-switcher.png       | Bin 0 -> 636 bytes
 data/22x22/panel-user-desktop.png        | Bin 0 -> 517 bytes
 data/32x32/panel-task-switcher.png       | Bin 0 -> 965 bytes
 data/32x32/panel-user-desktop.png        | Bin 0 -> 734 bytes
 data/48x48/panel-task-switcher.png       | Bin 0 -> 1588 bytes
 data/48x48/panel-user-desktop.png        | Bin 0 -> 1115 bytes
 data/64x64/panel-task-switcher.png       | Bin 0 -> 2328 bytes
 data/64x64/panel-user-desktop.png        | Bin 0 -> 1491 bytes
 data/Makefile.am                         |  18 +
 matchbox-panel.pc.in                     |   2 +-
 matchbox-panel/Makefile.am               |   4 +-
 matchbox-panel/mb-panel-scaling-image.c  |  37 +-
 matchbox-panel/mb-panel-scaling-image2.c | 451 ++++++++++++++++
 matchbox-panel/mb-panel-scaling-image2.h |  64 +++
 matchbox-panel/mb-panel.c                | 401 +++++++-------
 po/POTFILES.in                           |  24 +-
 39 files changed, 3209 insertions(+), 675 deletions(-)
 create mode 100644 applets/systray/fixedtip.c
 create mode 100644 applets/systray/fixedtip.h
 delete mode 100644 applets/systray/na-marshal.list
 create mode 100644 applets/systray/na-tray-child.c
 create mode 100644 applets/systray/na-tray-child.h
 create mode 100644 applets/systray/na-tray.c
 create mode 100644 applets/systray/na-tray.h
 create mode 100644 data/16x16/panel-task-switcher.png
 create mode 100644 data/16x16/panel-user-desktop.png
 create mode 100644 data/22x22/panel-task-switcher.png
 create mode 100644 data/22x22/panel-user-desktop.png
 create mode 100644 data/32x32/panel-task-switcher.png
 create mode 100644 data/32x32/panel-user-desktop.png
 create mode 100644 data/48x48/panel-task-switcher.png
 create mode 100644 data/48x48/panel-user-desktop.png
 create mode 100644 data/64x64/panel-task-switcher.png
 create mode 100644 data/64x64/panel-user-desktop.png
 create mode 100644 data/Makefile.am
 create mode 100644 matchbox-panel/mb-panel-scaling-image2.c
 create mode 100644 matchbox-panel/mb-panel-scaling-image2.h

-- 
2.8.1



^ permalink raw reply	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 01/25] build: check for GTK+3, and require 3.0
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 02/25] windowselector: port to GTK+ 3 Jussi Kukkonen
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 configure.ac | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 55de6ae..4f38032 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,10 +17,12 @@ GNOME_COMPILE_WARNINGS
 # base deps
 PKG_CHECK_MODULES(MATCHBOX_PANEL,
                   glib-2.0
+                  gmodule-export-2.0
                   x11
-                  gdk-x11-2.0
-                  gtk+-2.0 >= 2.18
-                  gmodule-export-2.0)
+                  gdk-x11-3.0
+                  gtk+-3.0)
+
+AC_DEFINE_UNQUOTED(GDK_VERSION_MIN_REQUIRED, [GDK_VERSION_3_0], [GTK+ API we require])
 
 # startup-notification
 AC_ARG_ENABLE(startup_notification,
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 02/25] windowselector: port to GTK+ 3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 01/25] build: check for GTK+3, and require 3.0 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 03/25] startup: " Jussi Kukkonen
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/windowselector/windowselector.c | 39 ++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/applets/windowselector/windowselector.c b/applets/windowselector/windowselector.c
index 4608a85..9c1dadf 100644
--- a/applets/windowselector/windowselector.c
+++ b/applets/windowselector/windowselector.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * (C) 2006, 2007 OpenedHand Ltd.
  *
  * Authors: Jorn Baayen <jorn@openedhand.com>
@@ -148,8 +148,9 @@ get_text_property (WindowSelectorApplet *applet,
         if (gdk_error_trap_pop () || result == 0)
                 return NULL;
 
-        count = gdk_text_property_to_utf8_list
-                        (gdk_x11_xatom_to_atom (text.encoding),
+        count = gdk_text_property_to_utf8_list_for_display
+                        (display,
+                         gdk_x11_xatom_to_atom (text.encoding),
                          text.format,
                          text.value,
                          text.nitems,
@@ -370,7 +371,7 @@ get_current_app_window (WindowSelectorApplet *applet)
 
 
         result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
-                                     GDK_WINDOW_XWINDOW (applet->root_window),
+                                     GDK_WINDOW_XID (applet->root_window),
                                      applet->atoms[_MB_CURRENT_APP_WINDOW],
                                      0, 1,
                                      False,
@@ -412,18 +413,18 @@ window_menu_item_activate_cb (GtkWidget            *widget,
                         (g_object_get_data (G_OBJECT (widget), "window"));
         screen = GDK_SCREEN_XSCREEN (gtk_widget_get_screen (widget));
         toplevel = gtk_widget_get_toplevel (GTK_WIDGET (applet->button));
-  
+
         /* Send _NET_ACTIVE_WINDOW message */
         xev.xclient.type = ClientMessage;
         xev.xclient.serial = 0;
         xev.xclient.send_event = True;
         xev.xclient.display = DisplayOfScreen (screen);
         xev.xclient.window = window;
-        xev.xclient.message_type = applet->atoms[_NET_ACTIVE_WINDOW]; 
+        xev.xclient.message_type = applet->atoms[_NET_ACTIVE_WINDOW];
         xev.xclient.format = 32;
         xev.xclient.data.l[0] = 2;
         xev.xclient.data.l[1] = gtk_get_current_event_time ();
-        xev.xclient.data.l[2] = GDK_WINDOW_XWINDOW (toplevel->window);
+        xev.xclient.data.l[2] = GDK_WINDOW_XID (gtk_widget_get_window (toplevel));
         xev.xclient.data.l[3] = 0;
         xev.xclient.data.l[4] = 0;
 
@@ -431,7 +432,7 @@ window_menu_item_activate_cb (GtkWidget            *widget,
 	            RootWindowOfScreen (screen),
                     False,
 	            SubstructureRedirectMask,
-	            &xev);        
+	            &xev);
 }
 
 
@@ -460,7 +461,7 @@ rebuild_menu (WindowSelectorApplet *applet)
 
         gdk_error_trap_push ();
         result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
-                                     GDK_WINDOW_XWINDOW (applet->root_window),
+                                     GDK_WINDOW_XID (applet->root_window),
                                      applet->atoms
                                              [_MB_APP_WINDOW_LIST_STACKING],
                                      0,
@@ -563,11 +564,13 @@ position_menu (GtkMenu  *menu,
                gpointer  user_data)
 {
         WindowSelectorApplet *applet = user_data;
-        
-        gdk_window_get_origin (applet->button->window, x, y);
-        
-        *x += applet->button->allocation.x;
-        *y += applet->button->allocation.height;
+        GtkAllocation allocation;
+
+        gdk_window_get_origin (gtk_widget_get_window (applet->button), x, y);
+        gtk_widget_get_allocation (applet->button, &allocation);
+
+        *x += allocation.x;
+        *y += allocation.height;
         *push_in = TRUE;
 }
 
@@ -658,7 +661,7 @@ filter_func (GdkXEvent            *xevent,
                     applet->atoms[_MB_APP_WINDOW_LIST_STACKING]) {
                         /* _MB_APP_WINDOW_LIST_STACKING changed.
                          * Rebuild menu if around. */
-                        if (applet->menu && GTK_WIDGET_VISIBLE (applet->menu))
+                        if (applet->menu && gtk_widget_get_visible (applet->menu))
                                 rebuild_menu (applet);
                 }
                 if (xev->xproperty.atom ==
@@ -744,7 +747,7 @@ screen_changed_cb (GtkWidget         *button,
                                applet);
         
         /* Rebuild menu if around */
-        if (applet->menu && GTK_WIDGET_VISIBLE (applet->menu))
+        if (applet->menu && gtk_widget_get_visible (applet->menu))
                 rebuild_menu (applet);
 
         update_current_app (applet);
@@ -800,12 +803,12 @@ mb_panel_applet_create (const char    *id,
                                 applet->image);
                 break;
         case MODE_ICON_NAME:
-                hbox = gtk_hbox_new (FALSE, 4);
+                hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
                 applet->label = gtk_label_new (NULL);
                 applet->image = gtk_image_new ();
                 gtk_box_pack_start (GTK_BOX (hbox), applet->image,
                                 FALSE, FALSE, 2);
-                gtk_box_pack_start (GTK_BOX (hbox), applet->label, 
+                gtk_box_pack_start (GTK_BOX (hbox), applet->label,
                                 TRUE, TRUE, 0);
                 gtk_container_add (GTK_CONTAINER (applet->button), hbox);
                 break;
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 03/25] startup: port to GTK+ 3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 01/25] build: check for GTK+3, and require 3.0 Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 02/25] windowselector: port to GTK+ 3 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 04/25] startup-notify: " Jussi Kukkonen
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/startup/startup.c | 63 +++++++++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 29 deletions(-)

diff --git a/applets/startup/startup.c b/applets/startup/startup.c
index 3554d4c..1b304da 100644
--- a/applets/startup/startup.c
+++ b/applets/startup/startup.c
@@ -1,10 +1,13 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  * startup-monitor - A tray app that provides feedback
  *                             on application startup.
  *
- * Copyright 2004 - 2007, Openedhand Ltd.
+ * Copyright 2004 - 2013, Intel Corp
  * By Matthew Allum <mallum@o-hand.com>,
  * Stefan Schmidt <stefan@openmoko.org>
+ * Ross Burton <ross.burton@intel.com>
  *
  * Based on mb-applet-startup-monitor
  *
@@ -16,7 +19,6 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
  */
 
 #include <stdio.h>
@@ -38,7 +40,7 @@
 #include <matchbox-panel/mb-panel.h>
 #include <matchbox-panel/mb-panel-scaling-image.h>
 
-#define TIMEOUT                   20
+#define TIMEOUT 20
 #define HOURGLASS_PIXMAPS 8
 
 typedef struct LaunchItem {
@@ -66,6 +68,7 @@ static gboolean timeout (StartupApplet *applet);
 static void
 startup_applet_free (StartupApplet *applet)
 {
+	/* TODO: this should be in unrealize */
         gdk_window_remove_filter (applet->root_window,
                                   (GdkFilterFunc) filter_func, applet);
         g_slice_free (StartupApplet, applet);
@@ -218,12 +221,38 @@ filter_func (GdkXEvent     *gdk_xevent,
         return GDK_FILTER_CONTINUE;
 }
 
+static void
+on_realize (GtkWidget *widget, gpointer user_data)
+{
+        StartupApplet *applet = user_data;
+        GdkDisplay *display;
+        GdkScreen *screen;
+        Display *xdisplay;
+
+        screen = gtk_widget_get_screen (widget);
+        display = gdk_screen_get_display (screen);
+        xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+        applet->root_window = gdk_screen_get_root_window (screen);
+
+        applet->sn_display = sn_display_new (xdisplay, NULL, NULL);
+        applet->sn_context = sn_monitor_context_new (applet->sn_display,
+                                                     gdk_screen_get_number (screen),
+                                                     monitor_event_func,
+                                                     applet, NULL);
+
+        XSelectInput (xdisplay,
+                      GDK_WINDOW_XID (applet->root_window),
+                      PropertyChangeMask);
+
+        gdk_window_add_filter (applet->root_window, (GdkFilterFunc)filter_func, applet);
+}
+
 G_MODULE_EXPORT GtkWidget *
 mb_panel_applet_create (const char    *id,
                         GtkOrientation orientation)
 {
         StartupApplet *applet;
-        Display *xdisplay;
 
         /* Create applet data structure */
         applet = g_slice_new0 (StartupApplet);
@@ -242,31 +271,7 @@ mb_panel_applet_create (const char    *id,
         g_object_weak_ref (G_OBJECT(applet->image),
                            (GWeakNotify) startup_applet_free, applet);
 
-        xdisplay = GDK_DISPLAY_XDISPLAY
-                                (gtk_widget_get_display
-                                        (GTK_WIDGET (applet->image)));
-
-        applet->sn_display = sn_display_new (xdisplay, NULL, NULL);
-
-        applet->sn_context = sn_monitor_context_new (applet->sn_display,
-                                                     DefaultScreen(xdisplay),
-                                                     monitor_event_func,
-                                                     (void *) applet,
-                                                     NULL);
-
-        /* We have to select for property events on at least one
-         * root window (but not all as INITIATE messages go to
-         * all root windows)
-         */
-        XSelectInput (xdisplay,
-                      DefaultRootWindow(xdisplay), PropertyChangeMask);
-
-        applet->root_window =
-                gdk_window_lookup_for_display
-                        (gdk_x11_lookup_xdisplay (xdisplay), 0);
-
-        gdk_window_add_filter (applet->root_window,
-                               (GdkFilterFunc) filter_func, applet);
+        g_signal_connect (applet->image, "realize", G_CALLBACK (on_realize), applet);
 
         return GTK_WIDGET (applet->image);
 }
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 04/25] startup-notify: port to GTK+ 3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (2 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 03/25] startup: " Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 05/25] showdesktop: " Jussi Kukkonen
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/startup-notify/startup.c | 65 +++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 21 deletions(-)

diff --git a/applets/startup-notify/startup.c b/applets/startup-notify/startup.c
index a65817a..a4686ef 100644
--- a/applets/startup-notify/startup.c
+++ b/applets/startup-notify/startup.c
@@ -302,37 +302,60 @@ init_notify (StartupApplet *applet)
   return TRUE;
 }
 
+static void
+screen_changed_cb (GtkWidget     *widget,
+                   GdkScreen     *old_screen,
+                   StartupApplet *applet)
+{
+  GdkScreen *screen;
+  GdkDisplay *display;
+  Display *xdisplay;
+
+  if (applet->root_window) {
+    gdk_window_remove_filter (applet->root_window,
+                              (GdkFilterFunc) filter_func,
+                              applet);
+  }
+
+  screen = gtk_widget_get_screen (widget);
+  display = gdk_screen_get_display (screen);
+
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  applet->sn_display = sn_display_new (xdisplay, NULL, NULL);
+
+  applet->sn_context = sn_monitor_context_new (applet->sn_display,
+                                               gdk_screen_get_number (screen),
+                                               monitor_event_func,
+                                               applet, NULL);
+
+  /* We have to select for property events on at least one root window (but not
+   * all as INITIATE messages go to all root windows)
+   */
+  XSelectInput (xdisplay, DefaultRootWindow (xdisplay), PropertyChangeMask);
+
+  applet->root_window = gdk_x11_window_lookup_for_display
+    (display, DefaultRootWindow (xdisplay));
+
+  gdk_window_add_filter (applet->root_window, (GdkFilterFunc)filter_func, applet);
+}
+
 G_MODULE_EXPORT GtkWidget *
 mb_panel_applet_create (const char *id, GtkOrientation orientation)
 {
   StartupApplet *applet;
   GtkWidget *widget;
-  Display *xdisplay;
-  
+
   applet = g_slice_new0 (StartupApplet);
 
-  widget = gtk_hbox_new (0, FALSE); /* grr */
+  widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   g_object_weak_ref (G_OBJECT (widget), (GWeakNotify)startup_applet_free, applet);
 
   if (init_notify (applet)) {
-    xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
-    
-    applet->sn_display = sn_display_new (xdisplay, NULL, NULL);
-    
-    applet->sn_context = sn_monitor_context_new (applet->sn_display,
-                                                 DefaultScreen (xdisplay),
-                                                 monitor_event_func,
-                                                 applet, NULL);
-
-    /* We have to select for property events on at least one root window (but not
-     * all as INITIATE messages go to all root windows)
-     */
-    XSelectInput (xdisplay, DefaultRootWindow (xdisplay), PropertyChangeMask);
-    
-    applet->root_window = gdk_window_lookup_for_display
-      (gdk_x11_lookup_xdisplay (xdisplay), 0);
-    
-    gdk_window_add_filter (applet->root_window, (GdkFilterFunc)filter_func, applet);
+          g_signal_connect (widget,
+                            "screen-changed",
+                            G_CALLBACK (screen_changed_cb),
+                            applet);
   }
 
   /* TODO: need to fix the panel to support invisible widgets */
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 05/25] showdesktop: port to GTK+ 3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (3 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 04/25] startup-notify: " Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 06/25] launcher: " Jussi Kukkonen
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/showdesktop/showdesktop.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/applets/showdesktop/showdesktop.c b/applets/showdesktop/showdesktop.c
index 33c13e1..e40ebc3 100644
--- a/applets/showdesktop/showdesktop.c
+++ b/applets/showdesktop/showdesktop.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * (C) 2006 OpenedHand Ltd.
  *
  * Author: Jorn Baayen <jorn@openedhand.com>
@@ -20,7 +20,7 @@ typedef struct {
         gboolean active;
 
         Atom atom;
-        
+
         GdkWindow *root_window;
 } ShowDesktopApplet;
 
@@ -50,7 +50,7 @@ set_active (ShowDesktopApplet *applet, gboolean active)
         applet->active = active;
 
         /* TODO: remove this function and instead use a toggle button? */
-        
+
         icon = "panel-user-desktop";
 
         mb_panel_scaling_image_set_icon (applet->image, icon);
@@ -71,8 +71,7 @@ sync_applet (ShowDesktopApplet *applet)
 
         gdk_error_trap_push ();
         result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
-                                     GDK_WINDOW_XWINDOW
-                                            (applet->root_window),
+                                     GDK_WINDOW_XID (applet->root_window),
                                      applet->atom,
                                      0,
                                      G_MAXLONG,
@@ -160,13 +159,13 @@ button_clicked_cb (GtkButton         *button,
 
         widget = GTK_WIDGET (button);
         screen = GDK_SCREEN_XSCREEN (gtk_widget_get_screen (widget));
-  
+
         xev.xclient.type = ClientMessage;
         xev.xclient.serial = 0;
         xev.xclient.send_event = True;
         xev.xclient.display = DisplayOfScreen (screen);
         xev.xclient.window = RootWindowOfScreen (screen);
-        xev.xclient.message_type = applet->atom; 
+        xev.xclient.message_type = applet->atom;
         xev.xclient.format = 32;
         xev.xclient.data.l[0] = !applet->active;
         xev.xclient.data.l[1] = 0;
@@ -194,12 +193,10 @@ mb_panel_applet_create (const char    *id,
         ShowDesktopApplet *applet;
         GtkWidget *button, *image;
 
-        /* Create applet data structure */
         applet = g_slice_new0 (ShowDesktopApplet);
 
         applet->root_window = NULL;
 
-        /* Create button */
         button = gtk_button_new ();
         applet->button = GTK_BUTTON (button);
 
@@ -231,7 +228,6 @@ mb_panel_applet_create (const char    *id,
                            (GWeakNotify) show_desktop_applet_free,
                            applet);
 
-        /* Show! */
         gtk_widget_show_all (button);
 
         return button;
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 06/25] launcher: port to GTK+ 3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (4 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 05/25] showdesktop: " Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 07/25] mb-panel: port to GTK+3 Jussi Kukkonen
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/launcher/launcher.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/applets/launcher/launcher.c b/applets/launcher/launcher.c
index 7e12814..0ec8a43 100644
--- a/applets/launcher/launcher.c
+++ b/applets/launcher/launcher.c
@@ -143,6 +143,7 @@ button_release_event_cb (GtkWidget      *event_box,
 {
         int x, y;
         pid_t child_pid = 0;
+        GtkAllocation allocation;
 #ifdef USE_LIBSN
         SnLauncherContext *context;
 #endif
@@ -154,16 +155,17 @@ button_release_event_cb (GtkWidget      *event_box,
 
         /* Only process if the button was released inside the button */
         gtk_widget_translate_coordinates (event_box,
-                                          event_box->parent,
+                                          gtk_widget_get_parent (event_box),
                                           event->x,
                                           event->y,
                                           &x,
                                           &y);
 
-        if (x < event_box->allocation.x ||
-            x > event_box->allocation.x + event_box->allocation.width ||
-            y < event_box->allocation.y ||
-            y > event_box->allocation.y + event_box->allocation.height)
+        gtk_widget_get_allocation (event_box, &allocation);
+        if (x < allocation.x ||
+            x > allocation.x + allocation.width ||
+            y < allocation.y ||
+            y > allocation.y + allocation.height)
                 return TRUE;
 
 #ifdef USE_LIBSN
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 07/25] mb-panel: port to GTK+3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (5 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 06/25] launcher: " Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 08/25] notify: port to GTK+ 3 Jussi Kukkonen
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

Whilst porting to GTK+ 3 the layout model was simplified: panels are always
full-width and you just pick an edge and size.  The panel is also multi-screen
and multi-monitor aware now.
---
 matchbox-panel/mb-panel.c | 368 +++++++++++++++++++++++-----------------------
 1 file changed, 187 insertions(+), 181 deletions(-)

diff --git a/matchbox-panel/mb-panel.c b/matchbox-panel/mb-panel.c
index 828a36d..1d6832f 100644
--- a/matchbox-panel/mb-panel.c
+++ b/matchbox-panel/mb-panel.c
@@ -1,9 +1,10 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
- * (C) 2006 OpenedHand Ltd.
+ * (C) 2006-2013 Intel Corp
  *
- * Author: Jorn Baayen <jorn@openedhand.com>
+ * Authors: Ross Burton <ross.burton@intel.com>
+ *          Jorn Baayen <jorn@openedhand.com>
  *
  * Licensed under the GPL v2 or greater.
  */
@@ -23,17 +24,16 @@
 
 static GList *open_modules = NULL; /* List of open modules */
 
-/* Extra width and height to reserve for panel struts (see --reserve-extra) */
-static gint extra_width  = 0;
-static gint extra_height = 0;
+enum {
+        ATOM_WM_STRUT_PARTIAL,
+        ATOM_MB_STATE,
+        ATOM_STATE_DOCT_TITLEBAR,
+        ATOM_DOCK_TITLEBAR_DESKTOP,
+        /* Counter */
+        ATOM_LAST
+};
 
-static gboolean snap_right = FALSE;
-static gboolean snap_bottom = FALSE;
-
-static gboolean center_vertical   = FALSE;
-static gboolean center_horizontal = FALSE;
-
-static gboolean fullscreen = FALSE;
+static Atom atoms[ATOM_LAST];
 
 /* Load applet @name with ID @id */
 static GtkWidget *
@@ -132,63 +132,70 @@ load_applets (const char    *applets_desc,
         g_strfreev (applets);
 }
 
-/* Set struts based on the window size and position */
 static void
-set_struts (GtkWidget *window, gint x, gint y, gint w, gint h)
+set_struts (GtkWidget *window, GtkPositionType edge, int size)
 {
-        static Atom net_wm_strut_partial = None;
-
-        guint32    struts [12];
-        gint       screen_width, screen_height;
-        GdkScreen *screen;
-
-        screen = gdk_screen_get_default ();
-
-        screen_width  = gdk_screen_get_width (screen);
-        screen_height = gdk_screen_get_height (screen);
-
-        /* left */
-        struts[0] = x == 0 ? w + extra_width : 0;
-        struts[4] = struts[0] ? y : 0;
-        struts[5] = struts[0] ? y + h : 0;
+        Display *xdisplay;
+        int x, y, w, h;
+        struct {
+                long left;
+                long right;
+                long top;
+                long bottom;
+                long left_start_y;
+                long left_end_y;
+                long right_start_y;
+                long right_end_y;
+                long top_start_x;
+                long top_end_x;
+                long bottom_start_x;
+                long bottom_end_x;
+        } struts = { 0, };
+
+        xdisplay = GDK_SCREEN_XDISPLAY (gtk_widget_get_screen (window));
+        g_assert (xdisplay);
 
-        /* right */
-        struts[1] = x + w == screen_width ? w + extra_width: 0;
-        struts[6] = struts[1] ? y : 0;
-        struts[7] = struts[1] ? y + h : 0;
-
-        /* top */
-        struts[2] = y == 0 ? h + extra_height: 0;
-        struts[8] = struts[2] ? x : 0;
-        struts[9] = struts[2] ? x + w : 0;
+        gtk_window_get_position (GTK_WINDOW (window), &x, &y);
+        gtk_window_get_size (GTK_WINDOW (window), &w, &h);
 
-        /* bottom */
-        struts[3] = y + h == screen_height ? h + extra_height : 0;
-        struts[10] = struts[3] ? x : 0;
-        struts[11] = struts[3] ? x + w : 0;
+        switch (edge) {
+        case GTK_POS_LEFT:
+                struts.left = size;
+                struts.left_start_y = y;
+                struts.left_end_y = y + h;
+                break;
+        case GTK_POS_RIGHT:
+                struts.right = size;
+                struts.right_start_y = y;
+                struts.right_end_y = y + h;
+                break;
+        case GTK_POS_TOP:
+                struts.top = size;
+                struts.top_start_x = x;
+                struts.top_end_x = x + w;
+                break;
+        case GTK_POS_BOTTOM:
+                struts.bottom = size;
+                struts.bottom_start_x = x;
+                struts.bottom_end_x = x + w;
+                break;
+        }
 
         gdk_error_trap_push ();
-
-        if (!net_wm_strut_partial)
-                net_wm_strut_partial = XInternAtom (GDK_DISPLAY () ,
-                                                    "_NET_WM_STRUT_PARTIAL",
-                                                    False);
-
-        XChangeProperty (GDK_DISPLAY (),
-                         GDK_WINDOW_XID (window->window),
-                         net_wm_strut_partial, XA_CARDINAL, 32,
+        XChangeProperty (xdisplay,
+                         GDK_WINDOW_XID (gtk_widget_get_window (window)),
+                         atoms[ATOM_WM_STRUT_PARTIAL], XA_CARDINAL, 32,
                          PropModeReplace,
                          (guchar *) &struts, 12);
-
-        gdk_error_trap_pop ();
+        gdk_error_trap_pop_ignored ();
 }
 
+#if 0
 static void
 screen_size_changed_cb (GdkScreen *screen, GtkWidget *window)
 {
         gint       x, y, w, h;
         gint       screen_width, screen_height;
-
         gtk_window_get_position (GTK_WINDOW (window), &x, &y);
         gtk_window_get_size (GTK_WINDOW (window), &w, &h);
 
@@ -232,6 +239,20 @@ screen_size_changed_cb (GdkScreen *screen, GtkWidget *window)
 
         set_struts (window, x, y, w, h);
 }
+#endif
+
+static void
+get_atoms (Display *xdisplay)
+{
+        static const char *names[] = {
+                "_NET_WM_STRUT_PARTIAL",
+                "_MB_WM_STATE",
+                "_MB_WM_STATE_DOCK_TITLEBAR",
+                "_MB_DOCK_TITLEBAR_SHOW_ON_DESKTOP"
+        };
+
+        XInternAtoms (xdisplay, (char**)names, G_N_ELEMENTS (names), False, atoms);
+}
 
 int
 main (int argc, char **argv)
@@ -239,54 +260,44 @@ main (int argc, char **argv)
         GOptionContext *option_context;
         GOptionGroup *option_group;
         GError *error;
-        char *geometry = NULL, *start_applets = NULL, *end_applets = NULL;
+        char *start_applets = NULL, *end_applets = NULL;
+        char *edge_string = NULL;
+        int size = DEFAULT_HEIGHT;
+        int screen_num = -1;
+        int monitor_num = -1;
+        GtkPositionType edge = GTK_POS_TOP;
         GtkWidget *window, *box, *frame;
+        GdkDisplay *display;
         GdkScreen *screen;
-        int panel_width, panel_height;
-        GtkOrientation orientation;
-        gboolean want_titlebar = FALSE;
+        GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL;
+        gboolean in_titlebar = FALSE;
+        GdkRectangle screen_geom;
 
+        /* TODO: add these as groups (applets / position) */
         GOptionEntry option_entries[] = {
-                { "geometry", 0, 0, G_OPTION_ARG_STRING, &geometry,
-                  N_("Panel geometry"), N_("[WIDTH][xHEIGHT][{+-}X[{+-}Y]]") },
                 { "start-applets", 0, 0, G_OPTION_ARG_STRING, &start_applets,
                   N_("Applets to pack at the start"), N_("APPLET[:APPLET_ID] ...") },
                 { "end-applets", 0, 0, G_OPTION_ARG_STRING, &end_applets,
                   N_("Applets to pack at the end"), N_("APPLET[:APPLET_ID] ...") },
-                { "titlebar", 0, 0, G_OPTION_ARG_NONE, &want_titlebar,
-                  N_("Display in window titlebar (If Matchbox theme supports)"),
-                  NULL },
-                { "reserve-extra-width", 0, 0, G_OPTION_ARG_INT, &extra_width,
-                  N_("Extra width to reserve in panel strut in addittion to "
-                     "the window width"),
-                  N_("pixels")},
-                { "reserve-extra-height", 0, 0, G_OPTION_ARG_INT, &extra_height,
-                  N_("Extra height to reserve in panel strut in addition to "
-                     "the window height"),
-                  N_("pixels")},
-                { "center-horizontally", 0, 0, G_OPTION_ARG_NONE,
-                  &center_horizontal,
-                  N_("Center panel horizontally"),
-                  NULL },
-                { "center-vertically", 0, 0, G_OPTION_ARG_NONE,
-                  &center_vertical,
-                  N_("Center panel vertically"),
-                  NULL },
-                { "fullscreen", 0, 0, G_OPTION_ARG_NONE,
-                  &fullscreen,
-                  N_("Stretch panel to fullscreen in dominant direction "
-                     "(if used together with the --geometry options "
-                     "while the offset in the dominant direction will be "
-                     "ignored, it must not be specified with the + prefix, "
-                     "e.g., --geometry=200x32+0-0"),
-                  NULL },
+
+                { "screen", 'n', 0, G_OPTION_ARG_INT, &screen_num,
+                  N_("Screen number"), N_("SCREEN") },
+                { "monitor", 'm', 0, G_OPTION_ARG_INT, &monitor_num,
+                  N_("Monitor number"), N_("MONITOR") },
+
+                { "titlebar", 't', 0, G_OPTION_ARG_NONE, &in_titlebar,
+                  N_("Display in window titlebar (with Matchbox theme support)"), NULL },
+                { "edge", 'e', 0, G_OPTION_ARG_STRING, &edge_string,
+                  N_("Panel edge"), N_("TOP|BOTTON|LEFT|RIGHT") },
+                { "size", 's', 0, G_OPTION_ARG_INT, &size,
+                  N_("Panel size"), N_("PIXELS")},
+
                 { NULL }
         };
 
         /* Make sure that GModule is supported */
         if (!g_module_supported ()) {
-                g_warning (_("gmodule support not found. gmodule support is "
-                             "required for matchbox-panel to work"));
+                g_warning (_("GModule support not found, this is required for matchbox-panel to work"));
                 return -1;
         }
 
@@ -316,44 +327,100 @@ main (int argc, char **argv)
 
         g_option_context_free (option_context);
 
+        /* Can't be in the titlebar *and* on an edge, so check for this and exit */
+        if (in_titlebar && edge_string) {
+                g_printerr ("Cannot specify both --edge and --titlebar\n");
+                return 1;
+        }
+
+        if (edge_string) {
+                if (g_ascii_strcasecmp (edge_string, "top") == 0) {
+                        edge = GTK_POS_TOP;
+                } else if (g_ascii_strcasecmp (edge_string, "bottom") == 0) {
+                        edge = GTK_POS_BOTTOM;
+                } else if (g_ascii_strcasecmp (edge_string, "left") == 0) {
+                        edge = GTK_POS_LEFT;
+                } else if (g_ascii_strcasecmp (edge_string, "right") == 0) {
+                        edge = GTK_POS_RIGHT;
+                } else {
+                        g_printerr ("Unparsable edge '%s', expecting top/bottom/left/right\n", edge_string);
+                        return 1;
+                }
+                g_free (edge_string);
+        }
+
         /* Set app name */
         g_set_application_name (_("Matchbox Panel"));
 
+        display = gdk_display_get_default ();
+
+        get_atoms (GDK_DISPLAY_XDISPLAY (display));
+
+        if (screen_num != -1) {
+                screen = gdk_display_get_screen (display, screen_num);
+        } else {
+                screen = gdk_display_get_default_screen (display);
+        }
+
+        if (monitor_num == -1) {
+                monitor_num = gdk_screen_get_primary_monitor (screen);
+        }
+
+        /* Note that this is bare monitor geometry and not the work area, so
+           panels will overlap. */
+        gdk_screen_get_monitor_geometry (screen, monitor_num, &screen_geom);
+
         /* Create window */
         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
         gtk_widget_set_name (window, "MatchboxPanel");
-
-        gtk_window_set_type_hint (GTK_WINDOW (window),
-                                  GDK_WINDOW_TYPE_HINT_DOCK);
+        gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DOCK);
+        gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
 
         /* No key focus please */
         gtk_window_set_accept_focus (GTK_WINDOW (window), FALSE);
 
-        /* Set default panel height */
-        screen = gtk_window_get_screen (GTK_WINDOW (window));
-        gtk_window_set_default_size (GTK_WINDOW (window),
-                                     gdk_screen_get_width (screen),
-                                     DEFAULT_HEIGHT);
-
-        /* Parse geometry string */
-        if (geometry) {
-                if (!gtk_window_parse_geometry (GTK_WINDOW (window),
-                                                geometry)) {
-                        g_warning ("Failed to parse geometry string");
-
-                        gtk_widget_destroy (window);
+        gtk_widget_realize (window);
 
-                        return 1;
+        /* Set size */
+        if (!in_titlebar) {
+                /* TODO: hook this up to GdkScreen:size-changed */
+
+                /* Orientation and size */
+                switch (edge) {
+                case GTK_POS_TOP:
+                case GTK_POS_BOTTOM:
+                        orientation = GTK_ORIENTATION_HORIZONTAL;
+                        gtk_widget_set_size_request (window,
+                                           screen_geom.width, size);
+                        break;
+                case GTK_POS_LEFT:
+                case GTK_POS_RIGHT:
+                        orientation = GTK_ORIENTATION_VERTICAL;
+                        gtk_widget_set_size_request (window,
+                                           size, screen_geom.height);
+                        break;
                 }
-        }
 
-        /* Determine window size */
-        gtk_window_get_size (GTK_WINDOW (window), &panel_width, &panel_height);
+                /* Position */
+                switch (edge) {
+                case GTK_POS_TOP:
+                case GTK_POS_LEFT:
+                        gtk_window_move (GTK_WINDOW (window),
+                                         screen_geom.x, screen_geom.y);
+                        break;
+                case GTK_POS_RIGHT:
+                        gtk_window_move (GTK_WINDOW (window),
+                                         screen_geom.x + screen_geom.width - size,
+                                         screen_geom.y);
+                        break;
+                case GTK_POS_BOTTOM:
+                        gtk_window_move (GTK_WINDOW (window),
+                                         screen_geom.x,
+                                         screen_geom.y + screen_geom.height - size);
+                }
 
-        /* Force size */
-        gtk_widget_set_size_request (window, panel_width, panel_height);
-        gtk_window_resize (GTK_WINDOW (window), panel_width, panel_height);
+                set_struts (window, edge, size);
+        }
 
         /* Add frame */
         frame = gtk_frame_new (NULL);
@@ -362,91 +429,30 @@ main (int argc, char **argv)
         gtk_widget_show (frame);
 
         /* Is this a horizontal or a vertical layout? */
-        if (panel_width >= panel_height) {
-                orientation = GTK_ORIENTATION_HORIZONTAL;
-
+        if (orientation == GTK_ORIENTATION_HORIZONTAL) {
                 gtk_widget_set_name (frame, "MatchboxPanelFrameHorizontal");
-
-                box = gtk_hbox_new (FALSE, 0);
         } else {
-                orientation = GTK_ORIENTATION_VERTICAL;
-
                 gtk_widget_set_name (frame, "MatchboxPanelFrameVertical");
-
-                box = gtk_vbox_new (FALSE, 0);
         }
+        box = gtk_box_new (orientation, 0);
 
         gtk_container_add (GTK_CONTAINER (frame), box);
         gtk_widget_show (box);
 
-        gtk_widget_realize (window);
-
+#if 0
         /* Do we want to display the panel in the Matchbox titlebar? */
-        if (want_titlebar) {
-                const char *names[] = {
-                        /* Set the Matchbox-specific window state */
-                        "_MB_WM_STATE",
-                        /* To the list of these atoms */
-                        "_MB_WM_STATE_DOCK_TITLEBAR",
-                        "_MB_DOCK_TITLEBAR_SHOW_ON_DESKTOP"
-                };
-                Atom atoms[G_N_ELEMENTS (names)];
-
-                XInternAtoms (GDK_DISPLAY (), (char**)names,
-                              G_N_ELEMENTS (names), False, atoms);
-
-                XChangeProperty (GDK_DISPLAY (),
-                                 GDK_WINDOW_XID (window->window),
+        if (in_titlebar) {
+                XChangeProperty (GDK_SCREEN_XDISPLAY (screen),
+                                 GDK_WINDOW_XID (gtk_widget_get_window (window)),
                                  atoms[0], XA_ATOM, 32,
                                  PropModeReplace,
                                  (unsigned char *) &atoms[1], 2);
         } else {
-                /* If we're not in a title bar, set the struts */
-                gint screen_width  = gdk_screen_get_width (screen);
-                gint screen_height = gdk_screen_get_height (screen);
-                gint x, y, w, h;
-
-                gtk_window_get_position (GTK_WINDOW (window), &x, &y);
-                gtk_window_get_size (GTK_WINDOW (window), &w, &h);
-
-                if (fullscreen)
-                        {
-                                if (w > h)
-                                        {
-                                                w = screen_width;
-                                                x = 0;
-                                        }
-                                else
-                                        {
-                                                h = screen_height;
-                                                y = 0;
-                                        }
-
-                                gtk_widget_set_size_request (window, w, h);
-                                gtk_window_resize (GTK_WINDOW (window), w, h);
-                        }
-
-                if (center_horizontal)
-                        x = (screen_width - w) / 2;
-
-                if (center_vertical)
-                        y = (screen_height - h)/ 2;
-
-                if (center_horizontal || center_vertical || fullscreen)
-                        gtk_window_move (GTK_WINDOW (window), x, y);
-
-
-                if (x + w == screen_width)
-                        snap_right = TRUE;
-
-                if (y + h == screen_height)
-                        snap_bottom = TRUE;
-
-                set_struts (window, x, y, w, h);
                 g_signal_connect (screen, "size-changed",
                                   G_CALLBACK (screen_size_changed_cb),
                                   window);
         }
+#endif
 
         /* Load applets */
         load_applets (start_applets,
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 08/25] notify: port to GTK+ 3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (6 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 07/25] mb-panel: port to GTK+3 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 09/25] systray: " Jussi Kukkonen
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/notify/applet.c          | 19 ++++++++++++-------
 applets/notify/mb-notification.c | 38 +++++++++++++++++++++-----------------
 2 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/applets/notify/applet.c b/applets/notify/applet.c
index 2920b12..2d896e8 100644
--- a/applets/notify/applet.c
+++ b/applets/notify/applet.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * (C) 2008 OpenedHand Ltd.
  *
  * Author: Ross Burton <ross@openedhand.com>
@@ -20,9 +20,13 @@ reposition (GtkWindow *window)
 
   screen = gtk_window_get_screen (window);
 
-  gtk_widget_size_request ((GtkWidget*)window, &req);
+  gtk_widget_get_preferred_size (GTK_WIDGET (window), &req, NULL);
+
   if (req.height) {
     gtk_window_resize (window, req.width, req.height);
+    /* TODO: get the primary monitor and then use
+       gdk_screen_get_monitor_geometry() to get the geometry of the primary
+       display, not the overall screen. */
     gtk_window_move (window,
                      gdk_screen_get_width (screen) - req.width,
                      gdk_screen_get_height (screen) - req.height);
@@ -45,7 +49,7 @@ find_widget (GtkContainer *container, guint32 id)
 {
   GList *children, *l;
   GtkWidget *w;
-  
+
   children = gtk_container_get_children (container);
   l = g_list_find_custom (children, GINT_TO_POINTER (id), id_compare);
   w = l ? l->data : NULL;
@@ -86,7 +90,7 @@ on_notification_closed (MbNotifyStore *store, guint id, guint reason, GtkWindow
   w = find_widget ((GtkContainer*)box, id);
   if (w)
     gtk_container_remove (GTK_CONTAINER (box), w);
-  
+
   reposition (window);
 }
 
@@ -95,14 +99,15 @@ mb_panel_applet_create (const char *id, GtkOrientation orientation)
 {
   GtkWidget *window, *box;
   MbNotifyStore *notify;
-  
+
   window = gtk_window_new (GTK_WINDOW_POPUP);
   gtk_widget_set_name (window, "MbNotificationBox");
-  
+  gtk_window_set_gravity (GTK_WINDOW (window), GDK_GRAVITY_SOUTH_EAST);
+
   box = gtk_vbox_new (TRUE, 0);
   gtk_container_add (GTK_CONTAINER (window), box);
   gtk_widget_show_all (window);
-  
+
   notify = mb_notify_store_new ();
   g_signal_connect (notify, "notification-added", G_CALLBACK (on_notification_added), window);
   g_signal_connect (notify, "notification-closed", G_CALLBACK (on_notification_closed), window);
diff --git a/applets/notify/mb-notification.c b/applets/notify/mb-notification.c
index 0d0e97c..e440ec9 100644
--- a/applets/notify/mb-notification.c
+++ b/applets/notify/mb-notification.c
@@ -9,7 +9,7 @@ enum {
 };
 
 static guint signals[N_SIGNALS];
-  
+
 #define GET_PRIVATE(o) \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), MB_TYPE_NOTIFICATION, MbNotificationPrivate))
 
@@ -31,17 +31,21 @@ on_button_release (MbNotification *notification, GdkEventButton *event)
   }
 }
 
-static gint
-expose (GtkWidget *widget, GdkEventExpose *event)
+static gboolean
+on_draw (GtkWidget *widget, cairo_t *cr)
 {
-  if (gtk_widget_is_drawable (widget)) {
-    gtk_paint_box (widget->style, widget->window,
-                   widget->state, GTK_SHADOW_OUT,
-                   &event->area, widget, "notification",
-                   0, 0, -1, -1);
-    
-    (*GTK_WIDGET_CLASS (mb_notification_parent_class)->expose_event) (widget, event);
-  }
+  GtkStyleContext *style;
+  int width, height;
+
+  style = gtk_widget_get_style_context (widget);
+
+  width = gtk_widget_get_allocated_width (widget);
+  height = gtk_widget_get_allocated_height (widget);
+
+  gtk_render_frame (style, cr, 0, 0, width, height);
+
+  (*GTK_WIDGET_CLASS (mb_notification_parent_class)->draw) (widget, cr);
+
   return FALSE;
 }
 
@@ -52,8 +56,8 @@ mb_notification_class_init (MbNotificationClass *klass)
 
   g_type_class_add_private (klass, sizeof (MbNotificationPrivate));
 
-  widget_class->expose_event = expose;
-  
+  widget_class->draw = on_draw;
+
   signals[CLOSED] = g_signal_new ("closed",
                                   G_OBJECT_CLASS_TYPE (klass),
                                   G_SIGNAL_RUN_FIRST,
@@ -73,13 +77,13 @@ mb_notification_init (MbNotification *self)
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), FALSE);
   gtk_widget_add_events (GTK_WIDGET (self), GDK_BUTTON_RELEASE_MASK);
   g_signal_connect (self, "button-release-event", G_CALLBACK (on_button_release), NULL);
-  
-  box = gtk_hbox_new (FALSE, 8);
+
+  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
   gtk_container_add (GTK_CONTAINER (self), box);
 
   priv->image = gtk_image_new ();
   gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0);
-  
+
   priv->label = gtk_label_new (NULL);
   gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0);
@@ -106,7 +110,7 @@ mb_notification_update (MbNotification *notification, Notification *n)
     /* TODO: should this default to no image, or "info" */
     gtk_image_clear (GTK_IMAGE (priv->image));
   }
-  
+
   s = g_strdup_printf ("<big><b>%s</b></big>\n"
                        "\n%s", n->summary, n->body ?: NULL);
   gtk_label_set_markup (GTK_LABEL (priv->label), s);
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 09/25] systray: port to GTK+ 3
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (7 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 08/25] notify: port to GTK+ 3 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 10/25] data: ship our own icons here instead of in sato-icon-theme Jussi Kukkonen
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

In the process refresh the bulk of the code from it's upstream in gnome-panel.
---
 applets/systray/Makefile.am       |  20 +-
 applets/systray/fixedtip.c        | 276 ++++++++++++
 applets/systray/fixedtip.h        |  68 +++
 applets/systray/na-marshal.list   |   3 -
 applets/systray/na-tray-child.c   | 526 +++++++++++++++++++++++
 applets/systray/na-tray-child.h   |  71 ++++
 applets/systray/na-tray-manager.c | 570 ++++++++++++++-----------
 applets/systray/na-tray-manager.h |  32 +-
 applets/systray/na-tray.c         | 863 ++++++++++++++++++++++++++++++++++++++
 applets/systray/na-tray.h         |  76 ++++
 applets/systray/systray.c         |  91 +---
 11 files changed, 2253 insertions(+), 343 deletions(-)
 create mode 100644 applets/systray/fixedtip.c
 create mode 100644 applets/systray/fixedtip.h
 delete mode 100644 applets/systray/na-marshal.list
 create mode 100644 applets/systray/na-tray-child.c
 create mode 100644 applets/systray/na-tray-child.h
 create mode 100644 applets/systray/na-tray.c
 create mode 100644 applets/systray/na-tray.h

diff --git a/applets/systray/Makefile.am b/applets/systray/Makefile.am
index e01fe0c..1788581 100644
--- a/applets/systray/Makefile.am
+++ b/applets/systray/Makefile.am
@@ -1,21 +1,17 @@
 include ../Makefile.applets
 
-%.c: %.list
-	$(AM_V_GEN) (echo "#include \"na-marshal.h\""; \
-	  $(GLIB_GENMARSHAL) --internal --prefix=_na_marshal $^ --body) > $@
-%.h: %.list
-	$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_na_marshal $^ --header > $@
-
 applet_LTLIBRARIES = libsystray.la
-libsystray_la_SOURCES = $(BUILT_SOURCES) \
+libsystray_la_SOURCES = systray.c \
+                        na-tray.c \
+			na-tray.h \
                         na-tray-manager.c \
 			na-tray-manager.h \
-			systray.c
-libsystray_la_LDFLAGS = -avoid-version -module
+                        na-tray-child.c \
+			na-tray-child.h \
+			fixedtip.c \
+			fixedtip.h
 
-EXTRA_DIST = na-marshal.list
-
-BUILT_SOURCES = na-marshal.c na-marshal.h
+libsystray_la_LDFLAGS = -avoid-version -module
 
 test_linkage_LDADD += libsystray.la
 
diff --git a/applets/systray/fixedtip.c b/applets/systray/fixedtip.c
new file mode 100644
index 0000000..861e4ab
--- /dev/null
+++ b/applets/systray/fixedtip.c
@@ -0,0 +1,276 @@
+/* Metacity fixed tooltip routine */
+
+/* 
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2003-2006 Vincent Untz
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "fixedtip.h"
+
+/* Signals */
+enum
+{
+  CLICKED,
+  LAST_SIGNAL
+};
+
+static guint fixedtip_signals[LAST_SIGNAL] = { 0 };
+
+struct _NaFixedTipPrivate
+{
+  GtkWidget      *parent;
+  GtkWidget      *label;
+  GtkOrientation  orientation;
+};
+
+G_DEFINE_TYPE (NaFixedTip, na_fixed_tip, GTK_TYPE_WINDOW)
+
+static gboolean
+button_press_handler (GtkWidget      *fixedtip,
+                      GdkEventButton *event,
+                      gpointer        data)
+{
+  if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
+    g_signal_emit (fixedtip, fixedtip_signals[CLICKED], 0);
+
+  return FALSE;
+}
+
+static gboolean
+na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr)
+{
+  GtkStyleContext *context;
+  GtkStateFlags state;
+  int width, height;
+
+  width = gtk_widget_get_allocated_width (widget);
+  height = gtk_widget_get_allocated_height (widget);
+
+  state = gtk_widget_get_state_flags (widget);
+  context = gtk_widget_get_style_context (widget);
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLTIP);
+  gtk_style_context_set_state (context, state);
+
+  cairo_save (cr);
+  gtk_render_background (context, cr,
+                         0., 0.,
+                         (gdouble)width,
+                         (gdouble)height);
+  cairo_restore (cr);
+
+  gtk_style_context_restore (context);
+
+  return FALSE;
+}
+
+static void
+na_fixed_tip_class_init (NaFixedTipClass *class)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+  widget_class->draw = na_fixed_tip_draw;
+
+  fixedtip_signals[CLICKED] =
+    g_signal_new ("clicked",
+		  G_OBJECT_CLASS_TYPE (class),
+		  G_SIGNAL_RUN_LAST,
+		  G_STRUCT_OFFSET (NaFixedTipClass, clicked),
+		  NULL, NULL, NULL,
+		  G_TYPE_NONE, 0);
+
+  g_type_class_add_private (class, sizeof (NaFixedTipPrivate));
+}
+
+/* Did you already see this code? Yes, it's gtk_tooltips_ force_window() ;-) */
+static void
+na_fixed_tip_init (NaFixedTip *fixedtip)
+{
+  GtkWidget *label;
+
+  fixedtip->priv = G_TYPE_INSTANCE_GET_PRIVATE (fixedtip, NA_TYPE_FIXED_TIP,
+                                                NaFixedTipPrivate);
+
+  gtk_window_set_type_hint (GTK_WINDOW (fixedtip),
+                            GDK_WINDOW_TYPE_HINT_TOOLTIP);
+
+  gtk_widget_set_app_paintable (GTK_WIDGET (fixedtip), TRUE);
+  gtk_window_set_resizable (GTK_WINDOW (fixedtip), FALSE);
+  gtk_widget_set_name (GTK_WIDGET (fixedtip), "gtk-tooltips");
+  gtk_container_set_border_width (GTK_CONTAINER (fixedtip), 4);
+
+  label = gtk_label_new (NULL);
+  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
+  gtk_widget_show (label);
+  gtk_container_add (GTK_CONTAINER (fixedtip), label);
+  fixedtip->priv->label = label;
+
+  gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK);
+
+  g_signal_connect (fixedtip, "button_press_event",
+                    G_CALLBACK (button_press_handler), NULL);
+
+  fixedtip->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+}
+
+static void
+na_fixed_tip_position (NaFixedTip *fixedtip)
+{
+  GdkScreen      *screen;
+  GdkWindow      *parent_window;
+  GtkRequisition  req;
+  int             root_x;
+  int             root_y;
+  int             parent_width;
+  int             parent_height;
+  int             screen_width;
+  int             screen_height;
+
+  screen = gtk_widget_get_screen (fixedtip->priv->parent);
+  parent_window = gtk_widget_get_window (fixedtip->priv->parent);
+
+  gtk_window_set_screen (GTK_WINDOW (fixedtip), screen);
+
+  gtk_widget_get_preferred_size (GTK_WIDGET (fixedtip), &req, NULL);
+
+  gdk_window_get_origin (parent_window, &root_x, &root_y);
+  parent_width = gdk_window_get_width (parent_window);
+  parent_height = gdk_window_get_height (parent_window);
+
+  screen_width = gdk_screen_get_width (screen);
+  screen_height = gdk_screen_get_height (screen);
+
+  /* pad between panel and message window */
+#define PAD 5
+  
+  if (fixedtip->priv->orientation == GTK_ORIENTATION_VERTICAL)
+    {
+      if (root_x <= screen_width / 2)
+        root_x += parent_width + PAD;
+      else
+        root_x -= req.width + PAD;
+    }
+  else
+    {
+      if (root_y <= screen_height / 2)
+        root_y += parent_height + PAD;
+      else
+        root_y -= req.height + PAD;
+    }
+
+  /* Push onscreen */
+  if ((root_x + req.width) > screen_width)
+    root_x = screen_width - req.width;
+
+  if ((root_y + req.height) > screen_height)
+    root_y = screen_height - req.height;
+  
+  gtk_window_move (GTK_WINDOW (fixedtip), root_x, root_y);
+}
+
+static void
+na_fixed_tip_parent_size_allocated (GtkWidget     *parent,
+                                    GtkAllocation *allocation,
+                                    NaFixedTip    *fixedtip)
+{
+  na_fixed_tip_position (fixedtip);
+}
+
+static void
+na_fixed_tip_parent_screen_changed (GtkWidget  *parent,
+                                    GdkScreen  *new_screen,
+                                    NaFixedTip *fixedtip)
+{
+  na_fixed_tip_position (fixedtip);
+}
+
+GtkWidget *
+na_fixed_tip_new (GtkWidget      *parent,
+                  GtkOrientation  orientation)
+{
+  NaFixedTip *fixedtip;
+
+  g_return_val_if_fail (parent != NULL, NULL);
+
+  fixedtip = g_object_new (NA_TYPE_FIXED_TIP,
+                           "type", GTK_WINDOW_POPUP,
+                           NULL);
+
+  fixedtip->priv->parent = parent;
+
+#if 0
+  //FIXME: would be nice to be able to get the toplevel for the tip, but this
+  //doesn't work
+  GtkWidget  *toplevel;
+  
+  toplevel = gtk_widget_get_toplevel (parent);
+  /*
+  if (toplevel && gtk_widget_is_toplevel (toplevel) && GTK_IS_WINDOW (toplevel))
+    gtk_window_set_transient_for (GTK_WINDOW (fixedtip), GTK_WINDOW (toplevel));
+    */
+#endif
+
+  fixedtip->priv->orientation = orientation;
+
+  //FIXME: would be nice to move the tip when the notification area moves
+  g_signal_connect_object (parent, "size-allocate",
+                           G_CALLBACK (na_fixed_tip_parent_size_allocated),
+                           fixedtip, 0);
+  g_signal_connect_object (parent, "screen-changed",
+                           G_CALLBACK (na_fixed_tip_parent_screen_changed),
+                           fixedtip, 0);
+
+  na_fixed_tip_position (fixedtip);
+
+  return GTK_WIDGET (fixedtip);
+}
+
+void
+na_fixed_tip_set_markup (GtkWidget  *widget,
+                         const char *markup_text)
+{
+  NaFixedTip *fixedtip;
+
+  g_return_if_fail (NA_IS_FIXED_TIP (widget));
+
+  fixedtip = NA_FIXED_TIP (widget);
+
+  gtk_label_set_markup (GTK_LABEL (fixedtip->priv->label),
+                        markup_text);
+
+  na_fixed_tip_position (fixedtip);
+}
+
+void
+na_fixed_tip_set_orientation (GtkWidget      *widget,
+                              GtkOrientation  orientation)
+{
+  NaFixedTip *fixedtip;
+
+  g_return_if_fail (NA_IS_FIXED_TIP (widget));
+
+  fixedtip = NA_FIXED_TIP (widget);
+
+  if (orientation == fixedtip->priv->orientation)
+    return;
+
+  fixedtip->priv->orientation = orientation;
+
+  na_fixed_tip_position (fixedtip);
+}
diff --git a/applets/systray/fixedtip.h b/applets/systray/fixedtip.h
new file mode 100644
index 0000000..a29e85c
--- /dev/null
+++ b/applets/systray/fixedtip.h
@@ -0,0 +1,68 @@
+/* Fixed tooltip routine */
+
+/* 
+ * Copyright (C) 2001 Havoc Pennington, 2002 Red Hat Inc.
+ * Copyright (C) 2003-2006 Vincent Untz
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef FIXED_TIP_H
+#define FIXED_TIP_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define NA_TYPE_FIXED_TIP			(na_fixed_tip_get_type ())
+#define NA_FIXED_TIP(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_FIXED_TIP, NaFixedTip))
+#define NA_FIXED_TIP_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_FIXED_TIP, NaFixedTipClass))
+#define NA_IS_FIXED_TIP(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_FIXED_TIP))
+#define NA_IS_FIXED_TIP_CLASS(klass)		(G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_FIXED_TIP))
+#define NA_FIXED_TIP_GET_CLASS(obj)		(G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_FIXED_TIP, NaFixedTipClass))
+
+typedef struct _NaFixedTip	  NaFixedTip;
+typedef struct _NaFixedTipPrivate NaFixedTipPrivate;
+typedef struct _NaFixedTipClass   NaFixedTipClass;
+
+struct _NaFixedTip
+{
+  GtkWindow parent_instance;
+
+  NaFixedTipPrivate *priv;
+};
+
+struct _NaFixedTipClass
+{
+  GtkWindowClass parent_class;
+
+  void (* clicked)    (NaFixedTip *fixedtip);
+};
+
+GType      na_fixed_tip_get_type (void);
+
+GtkWidget *na_fixed_tip_new (GtkWidget      *parent,
+                             GtkOrientation  orientation);
+
+void       na_fixed_tip_set_markup (GtkWidget  *widget,
+                                    const char *markup_text);
+
+void       na_fixed_tip_set_orientation (GtkWidget      *widget,
+                                         GtkOrientation  orientation);
+
+G_END_DECLS
+
+#endif /* FIXED_TIP_H */
diff --git a/applets/systray/na-marshal.list b/applets/systray/na-marshal.list
deleted file mode 100644
index e3fc399..0000000
--- a/applets/systray/na-marshal.list
+++ /dev/null
@@ -1,3 +0,0 @@
-VOID:OBJECT,OBJECT
-VOID:OBJECT,STRING,LONG,LONG
-VOID:OBJECT,LONG
diff --git a/applets/systray/na-tray-child.c b/applets/systray/na-tray-child.c
new file mode 100644
index 0000000..1042940
--- /dev/null
+++ b/applets/systray/na-tray-child.c
@@ -0,0 +1,526 @@
+/* na-tray-child.c
+ * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
+ * Copyright (C) 2003-2006 Vincent Untz
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "na-tray-child.h"
+
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+
+G_DEFINE_TYPE (NaTrayChild, na_tray_child, GTK_TYPE_SOCKET)
+
+static void
+na_tray_child_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (na_tray_child_parent_class)->finalize (object);
+}
+
+static void
+na_tray_child_realize (GtkWidget *widget)
+{
+  NaTrayChild *child = NA_TRAY_CHILD (widget);
+  GdkVisual *visual = gtk_widget_get_visual (widget);
+  GdkWindow *window;
+
+  GTK_WIDGET_CLASS (na_tray_child_parent_class)->realize (widget);
+
+  window = gtk_widget_get_window (widget);
+
+  if (child->has_alpha)
+    {
+      /* We have real transparency with an ARGB visual and the Composite
+       * extension. */
+
+      /* Set a transparent background */
+      cairo_pattern_t *transparent = cairo_pattern_create_rgba (0, 0, 0, 0);
+      gdk_window_set_background_pattern (window, transparent);
+      gdk_window_set_composited (window, TRUE);
+      cairo_pattern_destroy (transparent);
+
+      child->parent_relative_bg = FALSE;
+    }
+  else if (visual == gdk_window_get_visual (gdk_window_get_parent (window)))
+    {
+      /* Otherwise, if the visual matches the visual of the parent window, we
+       * can use a parent-relative background and fake transparency. */
+      gdk_window_set_background_pattern (window, NULL);
+
+      child->parent_relative_bg = TRUE;
+    }
+  else
+    {
+      /* Nothing to do; the icon will sit on top of an ugly gray box */
+      child->parent_relative_bg = FALSE;
+    }
+
+  gdk_window_set_composited (window, child->composited);
+
+  gtk_widget_set_app_paintable (GTK_WIDGET (child),
+                                child->parent_relative_bg || child->has_alpha);
+
+  /* Double-buffering will interfere with the parent-relative-background fake
+   * transparency, since the double-buffer code doesn't know how to fill in the
+   * background of the double-buffer correctly.
+   */
+  gtk_widget_set_double_buffered (GTK_WIDGET (child),
+                                  child->parent_relative_bg);
+}
+
+static void
+na_tray_child_style_set (GtkWidget *widget,
+                         GtkStyle  *previous_style)
+{
+  /* The default handler resets the background according to the new style.
+   * We either use a transparent background or a parent-relative background
+   * and ignore the style background. So, just don't chain up.
+   */
+}
+
+#if 0
+/* This is adapted from code that was commented out in na-tray-manager.c; the
+ * code in na-tray-manager.c wouldn't have worked reliably, this will. So maybe
+ * it can be reenabled. On other hand, things seem to be working fine without
+ * it.
+ *
+ * If reenabling, you need to hook it up in na_tray_child_class_init().
+ */
+static void
+na_tray_child_size_request (GtkWidget      *widget,
+                            GtkRequisition *request)
+{
+  GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_request (widget, request);
+
+  /*
+   * Make sure the icons have a meaningful size ..
+   */ 
+  if ((request->width < 16) || (request->height < 16))
+    {
+      gint nw = MAX (24, request->width);
+      gint nh = MAX (24, request->height);
+      g_warning ("Tray icon has requested a size of (%ix%i), resizing to (%ix%i)", 
+                 req.width, req.height, nw, nh);
+      request->width = nw;
+      request->height = nh;
+    }
+}
+#endif
+
+static void
+na_tray_child_size_allocate (GtkWidget      *widget,
+                             GtkAllocation  *allocation)
+{
+  NaTrayChild *child = NA_TRAY_CHILD (widget);
+  GtkAllocation widget_allocation;
+  gboolean moved, resized;
+
+  gtk_widget_get_allocation (widget, &widget_allocation);
+
+  moved = (allocation->x != widget_allocation.x ||
+	   allocation->y != widget_allocation.y);
+  resized = (allocation->width != widget_allocation.width ||
+	     allocation->height != widget_allocation.height);
+
+  /* When we are allocating the widget while mapped we need special handling
+   * for both real and fake transparency.
+   *
+   * Real transparency: we need to invalidate and trigger a redraw of the old
+   *   and new areas. (GDK really should handle this for us, but doesn't as of
+   *   GTK+-2.14)
+   *
+   * Fake transparency: if the widget moved, we need to force the contents to
+   *   be redrawn with the new offset for the parent-relative background.
+   */
+  if ((moved || resized) && gtk_widget_get_mapped (widget))
+    {
+      if (na_tray_child_has_alpha (child))
+        gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)),
+                                    &widget_allocation, FALSE);
+    }
+
+  GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_allocate (widget,
+                                                                allocation);
+
+  if ((moved || resized) && gtk_widget_get_mapped (widget))
+    {
+      if (na_tray_child_has_alpha (NA_TRAY_CHILD (widget)))
+        gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)),
+                                    &widget_allocation, FALSE);
+      else if (moved && child->parent_relative_bg)
+        na_tray_child_force_redraw (child);
+    }
+}
+
+/* The plug window should completely occupy the area of the child, so we won't
+ * get a draw event. But in case we do (the plug unmaps itself, say), this
+ * draw handler draws with real or fake transparency.
+ */
+static gboolean
+na_tray_child_draw (GtkWidget *widget,
+                    cairo_t   *cr)
+{
+  NaTrayChild *child = NA_TRAY_CHILD (widget);
+
+  if (na_tray_child_has_alpha (child))
+    {
+      /* Clear to transparent */
+      cairo_set_source_rgba (cr, 0, 0, 0, 0);
+      cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+      cairo_paint (cr);
+    }
+  else if (child->parent_relative_bg)
+    {
+      GdkWindow *window;
+      cairo_surface_t *target;
+      GdkRectangle clip_rect;
+
+      window = gtk_widget_get_window (widget);
+      target = cairo_get_group_target (cr);
+
+      gdk_cairo_get_clip_rectangle (cr, &clip_rect);
+
+      /* Clear to parent-relative pixmap
+       * We need to use direct X access here because GDK doesn't know about
+       * the parent relative pixmap. */
+      cairo_surface_flush (target);
+
+      XClearArea (GDK_WINDOW_XDISPLAY (window),
+                  GDK_WINDOW_XID (window),
+                  clip_rect.x, clip_rect.y,
+                  clip_rect.width, clip_rect.height,
+                  False);
+      cairo_surface_mark_dirty_rectangle (target,
+                                          clip_rect.x, clip_rect.y,
+                                          clip_rect.width, clip_rect.height);
+    }
+
+  return FALSE;
+}
+
+static void
+na_tray_child_init (NaTrayChild *child)
+{
+}
+
+static void
+na_tray_child_class_init (NaTrayChildClass *klass)
+{
+  GObjectClass *gobject_class;
+  GtkWidgetClass *widget_class;
+
+  gobject_class = (GObjectClass *)klass;
+  widget_class = (GtkWidgetClass *)klass;
+
+  gobject_class->finalize = na_tray_child_finalize;
+  widget_class->style_set = na_tray_child_style_set;
+  widget_class->realize = na_tray_child_realize;
+  widget_class->size_allocate = na_tray_child_size_allocate;
+  widget_class->draw = na_tray_child_draw;
+}
+
+GtkWidget *
+na_tray_child_new (GdkScreen *screen,
+                   Window     icon_window)
+{
+  XWindowAttributes window_attributes;
+  Display *xdisplay;
+  NaTrayChild *child;
+  GdkVisual *visual;
+  gboolean visual_has_alpha;
+  int red_prec, green_prec, blue_prec, depth;
+  int result;
+
+  g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+  g_return_val_if_fail (icon_window != None, NULL);
+
+  xdisplay = GDK_SCREEN_XDISPLAY (screen);
+
+  /* We need to determine the visual of the window we are embedding and create
+   * the socket in the same visual.
+   */
+
+  gdk_error_trap_push ();
+  result = XGetWindowAttributes (xdisplay, icon_window,
+                                 &window_attributes);
+  gdk_error_trap_pop_ignored ();
+
+  if (!result) /* Window already gone */
+    return NULL;
+
+  visual = gdk_x11_screen_lookup_visual (screen,
+                                         window_attributes.visual->visualid);
+  if (!visual) /* Icon window is on another screen? */
+    return NULL;
+
+  child = g_object_new (NA_TYPE_TRAY_CHILD, NULL);
+  child->icon_window = icon_window;
+
+  gtk_widget_set_visual (GTK_WIDGET (child), visual);
+
+  /* We have alpha if the visual has something other than red, green,
+   * and blue */
+  gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
+  gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
+  gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
+  depth = gdk_visual_get_depth (visual);
+
+  visual_has_alpha = red_prec + blue_prec + green_prec < depth;
+  child->has_alpha = (visual_has_alpha &&
+                      gdk_display_supports_composite (gdk_screen_get_display (screen)));
+
+  child->composited = child->has_alpha;
+
+  return GTK_WIDGET (child);
+}
+
+char *
+na_tray_child_get_title (NaTrayChild *child)
+{
+  char *retval = NULL;
+  GdkDisplay *display;
+  Atom utf8_string, atom, type;
+  int result;
+  int format;
+  gulong nitems;
+  gulong bytes_after;
+  gchar *val;
+
+  g_return_val_if_fail (NA_IS_TRAY_CHILD (child), NULL);
+
+  display = gtk_widget_get_display (GTK_WIDGET (child));
+
+  utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING");
+  atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME");
+
+  gdk_error_trap_push ();
+
+  result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
+                               child->icon_window,
+                               atom,
+                               0, G_MAXLONG,
+                               False, utf8_string,
+                               &type, &format, &nitems,
+                               &bytes_after, (guchar **)&val);
+  
+  if (gdk_error_trap_pop () || result != Success)
+    return NULL;
+
+  if (type != utf8_string ||
+      format != 8 ||
+      nitems == 0)
+    {
+      if (val)
+        XFree (val);
+      return NULL;
+    }
+
+  if (!g_utf8_validate (val, nitems, NULL))
+    {
+      XFree (val);
+      return NULL;
+    }
+
+  retval = g_strndup (val, nitems);
+
+  XFree (val);
+
+  return retval;
+}
+
+/**
+ * na_tray_child_has_alpha;
+ * @child: a #NaTrayChild
+ *
+ * Checks if the child has an ARGB visual and real alpha transparence.
+ * (as opposed to faked alpha transparency with an parent-relative
+ * background)
+ *
+ * Return value: %TRUE if the child has an alpha transparency
+ */
+gboolean
+na_tray_child_has_alpha (NaTrayChild *child)
+{
+  g_return_val_if_fail (NA_IS_TRAY_CHILD (child), FALSE);
+
+  return child->has_alpha;
+}
+
+/**
+ * na_tray_child_set_composited;
+ * @child: a #NaTrayChild
+ * @composited: %TRUE if the child's window should be redirected
+ *
+ * Sets whether the #GdkWindow of the child should be set redirected
+ * using gdk_window_set_composited(). By default this is based off of
+ * na_tray_child_has_alpha(), but it may be useful to override it in
+ * certain circumstances; for example, if the #NaTrayChild is added
+ * to a parent window and that parent window is composited against the
+ * background.
+ */
+void
+na_tray_child_set_composited (NaTrayChild *child,
+                              gboolean     composited)
+{
+  g_return_if_fail (NA_IS_TRAY_CHILD (child));
+
+  if (child->composited == composited)
+    return;
+
+  child->composited = composited;
+  if (gtk_widget_get_realized (GTK_WIDGET (child)))
+    gdk_window_set_composited (gtk_widget_get_window (GTK_WIDGET (child)),
+                               composited);
+}
+
+/* If we are faking transparency with a window-relative background, force a
+ * redraw of the icon. This should be called if the background changes or if
+ * the child is shifted with respect to the background.
+ */
+void
+na_tray_child_force_redraw (NaTrayChild *child)
+{
+  GtkWidget *widget = GTK_WIDGET (child);
+
+  if (gtk_widget_get_mapped (widget) && child->parent_relative_bg)
+    {
+#if 1
+      /* Sending an ExposeEvent might cause redraw problems if the
+       * icon is expecting the server to clear-to-background before
+       * the redraw. It should be ok for GtkStatusIcon or EggTrayIcon.
+       */
+      Display *xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
+      XEvent xev;
+      GdkWindow *plug_window;
+      GtkAllocation allocation;
+
+      plug_window = gtk_socket_get_plug_window (GTK_SOCKET (child));
+      gtk_widget_get_allocation (widget, &allocation);
+
+      xev.xexpose.type = Expose;
+      xev.xexpose.window = GDK_WINDOW_XID (plug_window);
+      xev.xexpose.x = 0;
+      xev.xexpose.y = 0;
+      xev.xexpose.width = allocation.width;
+      xev.xexpose.height = allocation.height;
+      xev.xexpose.count = 0;
+
+      gdk_error_trap_push ();
+      XSendEvent (xdisplay,
+                  xev.xexpose.window,
+                  False, ExposureMask,
+                  &xev);
+      gdk_error_trap_pop_ignored ();
+#else
+      /* Hiding and showing is the safe way to do it, but can result in more
+       * flickering.
+       */
+      gdk_window_hide (widget->window);
+      gdk_window_show (widget->window);
+#endif
+    }
+}
+
+/* from libwnck/xutils.c, comes as LGPLv2+ */
+static char *
+latin1_to_utf8 (const char *latin1)
+{
+  GString *str;
+  const char *p;
+
+  str = g_string_new (NULL);
+
+  p = latin1;
+  while (*p)
+    {
+      g_string_append_unichar (str, (gunichar) *p);
+      ++p;
+    }
+
+  return g_string_free (str, FALSE);
+}
+
+/* derived from libwnck/xutils.c, comes as LGPLv2+ */
+static void
+_get_wmclass (Display *xdisplay,
+              Window   xwindow,
+              char   **res_class,
+              char   **res_name)
+{
+  XClassHint ch;
+
+  ch.res_name = NULL;
+  ch.res_class = NULL;
+
+  gdk_error_trap_push ();
+  XGetClassHint (xdisplay, xwindow, &ch);
+  gdk_error_trap_pop_ignored ();
+
+  if (res_class)
+    *res_class = NULL;
+
+  if (res_name)
+    *res_name = NULL;
+
+  if (ch.res_name)
+    {
+      if (res_name)
+        *res_name = latin1_to_utf8 (ch.res_name);
+
+      XFree (ch.res_name);
+    }
+
+  if (ch.res_class)
+    {
+      if (res_class)
+        *res_class = latin1_to_utf8 (ch.res_class);
+
+      XFree (ch.res_class);
+    }
+}
+
+/**
+ * na_tray_child_get_wm_class;
+ * @child: a #NaTrayChild
+ * @res_name: return location for a string containing the application name of
+ * @child, or %NULL
+ * @res_class: return location for a string containing the application class of
+ * @child, or %NULL
+ *
+ * Fetches the resource associated with @child.
+ */
+void
+na_tray_child_get_wm_class (NaTrayChild  *child,
+                            char        **res_name,
+                            char        **res_class)
+{
+  GdkDisplay *display;
+
+  g_return_if_fail (NA_IS_TRAY_CHILD (child));
+
+  display = gtk_widget_get_display (GTK_WIDGET (child));
+
+  _get_wmclass (GDK_DISPLAY_XDISPLAY (display),
+                child->icon_window,
+                res_class,
+                res_name);
+}
diff --git a/applets/systray/na-tray-child.h b/applets/systray/na-tray-child.h
new file mode 100644
index 0000000..29cab3b
--- /dev/null
+++ b/applets/systray/na-tray-child.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* na-tray-child.h
+ * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
+ * Copyright (C) 2003-2006 Vincent Untz
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __NA_TRAY_CHILD_H__
+#define __NA_TRAY_CHILD_H__
+
+#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
+
+G_BEGIN_DECLS
+
+#define NA_TYPE_TRAY_CHILD		(na_tray_child_get_type ())
+#define NA_TRAY_CHILD(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_TRAY_CHILD, NaTrayChild))
+#define NA_TRAY_CHILD_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_TRAY_CHILD, NaTrayChildClass))
+#define NA_IS_TRAY_CHILD(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_TRAY_CHILD))
+#define NA_IS_TRAY_CHILD_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_TRAY_CHILD))
+#define NA_TRAY_CHILD_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_TRAY_CHILD, NaTrayChildClass))
+
+typedef struct _NaTrayChild	  NaTrayChild;
+typedef struct _NaTrayChildClass  NaTrayChildClass;
+typedef struct _NaTrayChildChild  NaTrayChildChild;
+
+struct _NaTrayChild
+{
+  GtkSocket parent_instance;
+  Window icon_window;
+  guint has_alpha : 1;
+  guint composited : 1;
+  guint parent_relative_bg : 1;
+};
+
+struct _NaTrayChildClass
+{
+  GtkSocketClass parent_class;
+};
+
+GType           na_tray_child_get_type        (void);
+
+GtkWidget      *na_tray_child_new            (GdkScreen    *screen,
+                                              Window        icon_window);
+char           *na_tray_child_get_title      (NaTrayChild  *child);
+gboolean        na_tray_child_has_alpha      (NaTrayChild  *child);
+void            na_tray_child_set_composited (NaTrayChild  *child,
+                                              gboolean      composited);
+void            na_tray_child_force_redraw   (NaTrayChild  *child);
+void            na_tray_child_get_wm_class   (NaTrayChild  *child,
+					      char        **res_name,
+					      char        **res_class);
+
+G_END_DECLS
+
+#endif /* __NA_TRAY_CHILD_H__ */
diff --git a/applets/systray/na-tray-manager.c b/applets/systray/na-tray-manager.c
index 8eaaba1..8999350 100644
--- a/applets/systray/na-tray-manager.c
+++ b/applets/systray/na-tray-manager.c
@@ -26,8 +26,6 @@
 
 #include "na-tray-manager.h"
 
-#include <gdkconfig.h>
-#include <glib/gi18n.h>
 #if defined (GDK_WINDOWING_X11)
 #include <gdk/gdkx.h>
 #include <X11/Xatom.h>
@@ -36,8 +34,6 @@
 #endif
 #include <gtk/gtk.h>
 
-#include "na-marshal.h"
-
 /* Signals */
 enum
 {
@@ -98,6 +94,25 @@ na_tray_manager_init (NaTrayManager *manager)
 {
   manager->invisible = NULL;
   manager->socket_table = g_hash_table_new (NULL, NULL);
+
+  manager->padding = 0;
+  manager->icon_size = 0;
+
+  manager->fg.red = 0;
+  manager->fg.green = 0;
+  manager->fg.blue = 0;
+
+  manager->error.red = 0xffff;
+  manager->error.green = 0;
+  manager->error.blue = 0;
+
+  manager->warning.red = 0xffff;
+  manager->warning.green = 0xffff;
+  manager->warning.blue = 0;
+
+  manager->success.red = 0;
+  manager->success.green = 0xffff;
+  manager->success.blue = 0;
 }
 
 static void
@@ -129,8 +144,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass)
 		  G_OBJECT_CLASS_TYPE (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (NaTrayManagerClass, tray_icon_added),
-		  NULL, NULL,
-		  g_cclosure_marshal_VOID__OBJECT,
+		  NULL, NULL, NULL,
 		  G_TYPE_NONE, 1,
 		  GTK_TYPE_SOCKET);
 
@@ -139,8 +153,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass)
 		  G_OBJECT_CLASS_TYPE (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (NaTrayManagerClass, tray_icon_removed),
-		  NULL, NULL,
-		  g_cclosure_marshal_VOID__OBJECT,
+		  NULL, NULL, NULL,
 		  G_TYPE_NONE, 1,
 		  GTK_TYPE_SOCKET);
   manager_signals[MESSAGE_SENT] =
@@ -148,8 +161,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass)
 		  G_OBJECT_CLASS_TYPE (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (NaTrayManagerClass, message_sent),
-		  NULL, NULL,
-		  _na_marshal_VOID__OBJECT_STRING_LONG_LONG,
+		  NULL, NULL, NULL,
 		  G_TYPE_NONE, 4,
 		  GTK_TYPE_SOCKET,
 		  G_TYPE_STRING,
@@ -160,8 +172,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass)
 		  G_OBJECT_CLASS_TYPE (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (NaTrayManagerClass, message_cancelled),
-		  NULL, NULL,
-		  _na_marshal_VOID__OBJECT_LONG,
+		  NULL, NULL, NULL,
 		  G_TYPE_NONE, 2,
 		  GTK_TYPE_SOCKET,
 		  G_TYPE_LONG);
@@ -170,8 +181,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass)
 		  G_OBJECT_CLASS_TYPE (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (NaTrayManagerClass, lost_selection),
-		  NULL, NULL,
-		  g_cclosure_marshal_VOID__VOID,
+		  NULL, NULL, NULL,
 		  G_TYPE_NONE, 0);
 
 #if defined (GDK_WINDOWING_X11)
@@ -252,120 +262,61 @@ static gboolean
 na_tray_manager_plug_removed (GtkSocket       *socket,
 			      NaTrayManager   *manager)
 {
-  Window *window;
+  NaTrayChild *child = NA_TRAY_CHILD (socket);
 
-  window = g_object_get_data (G_OBJECT (socket), "na-tray-child-window");
-
-  g_hash_table_remove (manager->socket_table, GINT_TO_POINTER (*window));
-  g_object_set_data (G_OBJECT (socket), "na-tray-child-window",
-		     NULL);
-  
-  g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, socket);
+  g_hash_table_remove (manager->socket_table,
+                       GINT_TO_POINTER (child->icon_window));
+  g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
 
   /* This destroys the socket. */
   return FALSE;
 }
 
 static void
-na_tray_manager_make_socket_transparent (GtkWidget *widget,
-                                         gpointer   user_data)
+na_tray_manager_handle_dock_request (NaTrayManager       *manager,
+				     XClientMessageEvent *xevent)
 {
-  if (GTK_WIDGET_NO_WINDOW (widget))
-    return;
+  Window icon_window = xevent->data.l[2];
+  GtkWidget *child;
 
-  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
-}
-
-static gboolean
-na_tray_manager_socket_exposed (GtkWidget      *widget,
-                                GdkEventExpose *event,
-                                gpointer        user_data)
-{
-  gdk_window_clear_area (widget->window,
-                         event->area.x, event->area.y,
-                         event->area.width, event->area.height);
-  return FALSE;
-}
+  if (g_hash_table_lookup (manager->socket_table,
+                           GINT_TO_POINTER (icon_window)))
+    {
+      /* We already got this notification earlier, ignore this one */
+      return;
+    }
 
-static void
-na_tray_manager_socket_style_set (GtkWidget *widget,
-                                  GtkStyle  *previous_style,
-                                  gpointer   user_data)
-{
-  if (widget->window == NULL)
+  child = na_tray_child_new (manager->screen, icon_window);
+  if (child == NULL) /* already gone or other error */
     return;
 
-  na_tray_manager_make_socket_transparent (widget, user_data);
-}
+  g_signal_emit (manager, manager_signals[TRAY_ICON_ADDED], 0,
+		 child);
 
-static void
-na_tray_manager_handle_dock_request (NaTrayManager       *manager,
-				     XClientMessageEvent *xevent)
-{
-  GtkWidget *socket;
-  Window *window;
-  GtkRequisition req;
+  /* If the child wasn't attached, then destroy it */
 
-  if (g_hash_table_lookup (manager->socket_table, GINT_TO_POINTER (xevent->data.l[2])))
+  if (!GTK_IS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (child))))
     {
-      /* We already got this notification earlier, ignore this one */
+      gtk_widget_destroy (child);
       return;
     }
-  
-  socket = gtk_socket_new ();
-
-  gtk_widget_set_app_paintable (socket, TRUE);
-  //FIXME: need to find a theme where this (and expose event) is needed
-  gtk_widget_set_double_buffered (socket, FALSE);
-  g_signal_connect (socket, "realize",
-                    G_CALLBACK (na_tray_manager_make_socket_transparent), NULL);
-  g_signal_connect (socket, "expose_event",
-                    G_CALLBACK (na_tray_manager_socket_exposed), NULL);
-  g_signal_connect_after (socket, "style_set",
-                          G_CALLBACK (na_tray_manager_socket_style_set), NULL);
-  
-  /* We need to set the child window here
-   * so that the client can call _get functions
-   * in the signal handler
-   */
-  window = g_new (Window, 1);
-  *window = xevent->data.l[2];
-      
-  g_object_set_data_full (G_OBJECT (socket),
-			  "na-tray-child-window",
-			  window, g_free);
-  g_signal_emit (manager, manager_signals[TRAY_ICON_ADDED], 0,
-		 socket);
 
-  /* Add the socket only if it's been attached */
-  if (GTK_IS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (socket))))
+  g_signal_connect (child, "plug_removed",
+		    G_CALLBACK (na_tray_manager_plug_removed), manager);
+
+  gtk_socket_add_id (GTK_SOCKET (child), icon_window);
+
+  if (!gtk_socket_get_plug_window (GTK_SOCKET (child)))
     {
-      g_signal_connect (socket, "plug_removed",
-			G_CALLBACK (na_tray_manager_plug_removed), manager);
-      
-      gtk_socket_add_id (GTK_SOCKET (socket), *window);
-
-      g_hash_table_insert (manager->socket_table, GINT_TO_POINTER (*window), socket);
-
-      /*
-       * Make sure the icons have a meaningfull size ...
-       */ 
-      req.width = req.height = 1;
-      gtk_widget_size_request (socket, &req);
-      /*
-      if ((req.width < 16) || (req.height < 16))
-      {
-          gint nw = MAX (24, req.width);
-          gint nh = MAX (24, req.height);
-          g_warning (_("tray icon has requested a size of (%i x %i), resizing to (%i x %i)"), 
-                      req.width, req.height, nw, nh);
-          gtk_widget_set_size_request(icon, nw,  nh);
-      }
-      */
-      gtk_widget_show(socket);
+      /* Embedding failed, we won't get a plug-removed signal */
+      /* This signal destroys the socket */
+      g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
+      return;
     }
-  else
-    gtk_widget_destroy (socket);
+
+  g_hash_table_insert (manager->socket_table,
+                       GINT_TO_POINTER (icon_window), child);
+  gtk_widget_show (child);
 }
 
 static void
@@ -375,19 +326,13 @@ pending_message_free (PendingMessage *message)
   g_free (message);
 }
 
-static GdkFilterReturn
-na_tray_manager_handle_client_message_message_data (GdkXEvent *xev,
-                                                    GdkEvent  *event,
-                                                    gpointer   data)
+static void
+na_tray_manager_handle_message_data (NaTrayManager       *manager,
+				     XClientMessageEvent *xevent)
 {
-  XClientMessageEvent *xevent;
-  NaTrayManager       *manager;
-  GList               *p;
-  int                  len;
+  GList *p;
+  int    len;
   
-  xevent  = (XClientMessageEvent *) xev;
-  manager = data;
-
   /* Try to see if we can find the pending message in the list */
   for (p = manager->messages; p; p = p->next)
     {
@@ -421,8 +366,6 @@ na_tray_manager_handle_client_message_message_data (GdkXEvent *xev,
           break;
 	}
     }
-
-  return GDK_FILTER_REMOVE;
 }
 
 static void
@@ -442,26 +385,26 @@ na_tray_manager_handle_begin_message (NaTrayManager       *manager,
   if (!socket)
     return;
 
+  timeout = xevent->data.l[2];
+  len     = xevent->data.l[3];
+  id      = xevent->data.l[4];
+
   /* Check if the same message is already in the queue and remove it if so */
   for (p = manager->messages; p; p = p->next)
     {
-      PendingMessage *msg = p->data;
+      PendingMessage *pmsg = p->data;
 
-      if (xevent->window == msg->window &&
-	  xevent->data.l[4] == msg->id)
+      if (xevent->window == pmsg->window &&
+	  id == pmsg->id)
 	{
 	  /* Hmm, we found it, now remove it */
-	  pending_message_free (msg);
+	  pending_message_free (pmsg);
 	  manager->messages = g_list_remove_link (manager->messages, p);
           g_list_free_1 (p);
 	  break;
 	}
     }
 
-  timeout = xevent->data.l[2];
-  len     = xevent->data.l[3];
-  id      = xevent->data.l[4];
-
   if (len == 0)
     {
       g_signal_emit (manager, manager_signals[MESSAGE_SENT], 0,
@@ -488,6 +431,9 @@ na_tray_manager_handle_cancel_message (NaTrayManager       *manager,
 {
   GList     *p;
   GtkSocket *socket;
+  long       id;
+
+  id = xevent->data.l[2];
   
   /* Check if the message is in the queue and remove it if so */
   for (p = manager->messages; p; p = p->next)
@@ -495,7 +441,7 @@ na_tray_manager_handle_cancel_message (NaTrayManager       *manager,
       PendingMessage *msg = p->data;
 
       if (xevent->window == msg->window &&
-	  xevent->data.l[4] == msg->id)
+	  id == msg->id)
 	{
 	  pending_message_free (msg);
 	  manager->messages = g_list_remove_link (manager->messages, p);
@@ -515,39 +461,6 @@ na_tray_manager_handle_cancel_message (NaTrayManager       *manager,
 }
 
 static GdkFilterReturn
-na_tray_manager_handle_client_message_opcode (GdkXEvent *xev,
-                                              GdkEvent  *event,
-                                              gpointer   data)
-{
-  XClientMessageEvent *xevent;
-  NaTrayManager       *manager;
-
-  xevent  = (XClientMessageEvent *) xev;
-  manager = data;
-
-  switch (xevent->data.l[1])
-    {
-    case SYSTEM_TRAY_REQUEST_DOCK:
-      /* Ignore this one since we don't know on which window this was received
-       * and so we can't know for which screen this is. It will be handled
-       * in na_tray_manager_window_filter() since we also receive it there */
-      break;
-
-    case SYSTEM_TRAY_BEGIN_MESSAGE:
-      na_tray_manager_handle_begin_message (manager, xevent);
-      return GDK_FILTER_REMOVE;
-
-    case SYSTEM_TRAY_CANCEL_MESSAGE:
-      na_tray_manager_handle_cancel_message (manager, xevent);
-      return GDK_FILTER_REMOVE;
-    default:
-      break;
-    }
-
-  return GDK_FILTER_CONTINUE;
-}
-
-static GdkFilterReturn
 na_tray_manager_window_filter (GdkXEvent *xev,
                                GdkEvent  *event,
                                gpointer   data)
@@ -557,8 +470,7 @@ na_tray_manager_window_filter (GdkXEvent *xev,
 
   if (xevent->type == ClientMessage)
     {
-      /* We handle this client message here. See comment in
-       * na_tray_manager_handle_client_message_opcode() for details */
+      /* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_REQUEST_DOCK */
       if (xevent->xclient.message_type == manager->opcode_atom &&
           xevent->xclient.data.l[1]    == SYSTEM_TRAY_REQUEST_DOCK)
 	{
@@ -566,6 +478,29 @@ na_tray_manager_window_filter (GdkXEvent *xev,
                                                (XClientMessageEvent *) xevent);
           return GDK_FILTER_REMOVE;
 	}
+      /* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_BEGIN_MESSAGE */
+      else if (xevent->xclient.message_type == manager->opcode_atom &&
+               xevent->xclient.data.l[1]    == SYSTEM_TRAY_BEGIN_MESSAGE)
+        {
+          na_tray_manager_handle_begin_message (manager,
+                                                (XClientMessageEvent *) event);
+          return GDK_FILTER_REMOVE;
+        }
+      /* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_CANCEL_MESSAGE */
+      else if (xevent->xclient.message_type == manager->opcode_atom &&
+               xevent->xclient.data.l[1]    == SYSTEM_TRAY_CANCEL_MESSAGE)
+        {
+          na_tray_manager_handle_cancel_message (manager,
+                                                 (XClientMessageEvent *) event);
+          return GDK_FILTER_REMOVE;
+        }
+      /* _NET_SYSTEM_TRAY_MESSAGE_DATA */
+      else if (xevent->xclient.message_type == manager->message_data_atom)
+        {
+          na_tray_manager_handle_message_data (manager,
+                                               (XClientMessageEvent *) event);
+          return GDK_FILTER_REMOVE;
+        }
     }
   else if (xevent->type == SelectionClear)
     {
@@ -598,21 +533,24 @@ na_tray_manager_unmanage (NaTrayManager *manager)
   GdkDisplay *display;
   guint32     timestamp;
   GtkWidget  *invisible;
+  GdkWindow  *window;
 
   if (manager->invisible == NULL)
     return;
 
   invisible = manager->invisible;
+  window = gtk_widget_get_window (invisible);
+
   g_assert (GTK_IS_INVISIBLE (invisible));
   g_assert (gtk_widget_get_realized (invisible));
-  g_assert (GDK_IS_WINDOW (invisible->window));
+  g_assert (GDK_IS_WINDOW (window));
   
   display = gtk_widget_get_display (invisible);
   
   if (gdk_selection_owner_get_for_display (display, manager->selection_atom) ==
-      invisible->window)
+      window)
     {
-      timestamp = gdk_x11_get_server_time (invisible->window);      
+      timestamp = gdk_x11_get_server_time (window);
       gdk_selection_owner_set_for_display (display,
                                            NULL,
                                            manager->selection_atom,
@@ -620,10 +558,7 @@ na_tray_manager_unmanage (NaTrayManager *manager)
                                            TRUE);
     }
 
-  //FIXME: we should also use gdk_remove_client_message_filter when it's
-  //available
-  // See bug #351254
-  gdk_window_remove_filter (invisible->window,
+  gdk_window_remove_filter (window,
                             na_tray_manager_window_filter, manager);  
 
   manager->invisible = NULL; /* prior to destroy for reentrancy paranoia */
@@ -636,12 +571,14 @@ static void
 na_tray_manager_set_orientation_property (NaTrayManager *manager)
 {
 #ifdef GDK_WINDOWING_X11
+  GdkWindow  *window;
   GdkDisplay *display;
   Atom        orientation_atom;
   gulong      data[1];
 
-  if (!manager->invisible || !manager->invisible->window)
-    return;
+  g_return_if_fail (manager->invisible != NULL);
+  window = gtk_widget_get_window (manager->invisible);
+  g_return_if_fail (window != NULL);
 
   display = gtk_widget_get_display (manager->invisible);
   orientation_atom = gdk_x11_get_xatom_by_name_for_display (display,
@@ -652,7 +589,7 @@ na_tray_manager_set_orientation_property (NaTrayManager *manager)
 		SYSTEM_TRAY_ORIENTATION_VERT;
 
   XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
-		   GDK_WINDOW_XWINDOW (manager->invisible->window),
+		   GDK_WINDOW_XID (window),
                    orientation_atom,
 		   XA_CARDINAL, 32,
 		   PropModeReplace,
@@ -660,6 +597,150 @@ na_tray_manager_set_orientation_property (NaTrayManager *manager)
 #endif
 }
 
+static void
+na_tray_manager_set_visual_property (NaTrayManager *manager)
+{
+#ifdef GDK_WINDOWING_X11
+  GdkWindow  *window;
+  GdkDisplay *display;
+  Visual     *xvisual;
+  Atom        visual_atom;
+  gulong      data[1];
+
+  g_return_if_fail (manager->invisible != NULL);
+  window = gtk_widget_get_window (manager->invisible);
+  g_return_if_fail (window != NULL);
+
+  /* The visual property is a hint to the tray icons as to what visual they
+   * should use for their windows. If the X server has RGBA colormaps, then
+   * we tell the tray icons to use a RGBA colormap and we'll composite the
+   * icon onto its parents with real transparency. Otherwise, we just tell
+   * the icon to use our colormap, and we'll do some hacks with parent
+   * relative backgrounds to simulate transparency.
+   */
+
+  display = gtk_widget_get_display (manager->invisible);
+  visual_atom = gdk_x11_get_xatom_by_name_for_display (display,
+						       "_NET_SYSTEM_TRAY_VISUAL");
+
+  if (gdk_screen_get_rgba_visual (manager->screen) != NULL &&
+      gdk_display_supports_composite (display))
+    xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_rgba_visual (manager->screen));
+  else
+    {
+      /* We actually want the visual of the tray where the icons will
+       * be embedded. In almost all cases, this will be the same as the visual
+       * of the screen.
+       */
+      xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (manager->screen));
+    }
+
+  data[0] = XVisualIDFromVisual (xvisual);
+
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+                   GDK_WINDOW_XID (window),
+                   visual_atom,
+                   XA_VISUALID, 32,
+                   PropModeReplace,
+                   (guchar *) &data, 1);
+#endif
+}
+
+static void
+na_tray_manager_set_padding_property (NaTrayManager *manager)
+{
+#ifdef GDK_WINDOWING_X11
+  GdkWindow  *window;
+  GdkDisplay *display;
+  Atom        atom;
+  gulong      data[1];
+
+  g_return_if_fail (manager->invisible != NULL);
+  window = gtk_widget_get_window (manager->invisible);
+  g_return_if_fail (window != NULL);
+
+  display = gtk_widget_get_display (manager->invisible);
+  atom = gdk_x11_get_xatom_by_name_for_display (display,
+                                                "_NET_SYSTEM_TRAY_PADDING");
+
+  data[0] = manager->padding;
+
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+                   GDK_WINDOW_XID (window),
+                   atom,
+                   XA_CARDINAL, 32,
+                   PropModeReplace,
+                   (guchar *) &data, 1);
+#endif
+}
+
+static void
+na_tray_manager_set_icon_size_property (NaTrayManager *manager)
+{
+#ifdef GDK_WINDOWING_X11
+  GdkWindow  *window;
+  GdkDisplay *display;
+  Atom        atom;
+  gulong      data[1];
+
+  g_return_if_fail (manager->invisible != NULL);
+  window = gtk_widget_get_window (manager->invisible);
+  g_return_if_fail (window != NULL);
+
+  display = gtk_widget_get_display (manager->invisible);
+  atom = gdk_x11_get_xatom_by_name_for_display (display,
+                                                "_NET_SYSTEM_TRAY_ICON_SIZE");
+
+  data[0] = manager->icon_size;
+
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+                   GDK_WINDOW_XID (window),
+                   atom,
+                   XA_CARDINAL, 32,
+                   PropModeReplace,
+                   (guchar *) &data, 1);
+#endif
+}
+
+static void
+na_tray_manager_set_colors_property (NaTrayManager *manager)
+{
+#ifdef GDK_WINDOWING_X11
+  GdkWindow  *window;
+  GdkDisplay *display;
+  Atom        atom;
+  gulong      data[12];
+
+  g_return_if_fail (manager->invisible != NULL);
+  window = gtk_widget_get_window (manager->invisible);
+  g_return_if_fail (window != NULL);
+
+  display = gtk_widget_get_display (manager->invisible);
+  atom = gdk_x11_get_xatom_by_name_for_display (display,
+                                                "_NET_SYSTEM_TRAY_COLORS");
+
+  data[0] = manager->fg.red;
+  data[1] = manager->fg.green;
+  data[2] = manager->fg.blue;
+  data[3] = manager->error.red;
+  data[4] = manager->error.green;
+  data[5] = manager->error.blue;
+  data[6] = manager->warning.red;
+  data[7] = manager->warning.green;
+  data[8] = manager->warning.blue;
+  data[9] = manager->success.red;
+  data[10] = manager->success.green;
+  data[11] = manager->success.blue;
+
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+                   GDK_WINDOW_XID (window),
+                   atom,
+                   XA_CARDINAL, 32,
+                   PropModeReplace,
+                   (guchar *) &data, 12);
+#endif
+}
+
 #ifdef GDK_WINDOWING_X11
 
 static gboolean
@@ -669,6 +750,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
   GdkDisplay *display;
   Screen     *xscreen;
   GtkWidget  *invisible;
+  GdkWindow  *window;
   char       *selection_atom_name;
   guint32     timestamp;
   
@@ -682,6 +764,9 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
   if (na_tray_manager_check_running_screen_x11 (screen))
     return FALSE;
 #endif
+  
+  manager->screen = screen;
+
   display = gdk_screen_get_display (screen);
   xscreen = GDK_SCREEN_XSCREEN (screen);
   
@@ -696,13 +781,22 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
   manager->selection_atom = gdk_atom_intern (selection_atom_name, FALSE);
   g_free (selection_atom_name);
 
+  manager->invisible = invisible;
+  g_object_ref (G_OBJECT (manager->invisible));
+
   na_tray_manager_set_orientation_property (manager);
+  na_tray_manager_set_visual_property (manager);
+  na_tray_manager_set_padding_property (manager);
+  na_tray_manager_set_icon_size_property (manager);
+  na_tray_manager_set_colors_property (manager);
   
-  timestamp = gdk_x11_get_server_time (invisible->window);
+  window = gtk_widget_get_window (invisible);
+
+  timestamp = gdk_x11_get_server_time (window);
 
   /* Check if we could set the selection owner successfully */
   if (gdk_selection_owner_set_for_display (display,
-                                           invisible->window,
+                                           window,
                                            manager->selection_atom,
                                            timestamp,
                                            TRUE))
@@ -720,7 +814,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
       xev.data.l[0] = timestamp;
       xev.data.l[1] = gdk_x11_atom_to_xatom_for_display (display,
                                                          manager->selection_atom);
-      xev.data.l[2] = GDK_WINDOW_XWINDOW (invisible->window);
+      xev.data.l[2] = GDK_WINDOW_XID (window);
       xev.data.l[3] = 0;	/* manager specific data */
       xev.data.l[4] = 0;	/* manager specific data */
 
@@ -728,15 +822,14 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
 		  RootWindowOfScreen (xscreen),
 		  False, StructureNotifyMask, (XEvent *)&xev);
 
-      manager->invisible = invisible;
-      g_object_ref (G_OBJECT (manager->invisible));
-      
       opcode_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_OPCODE", FALSE);
       manager->opcode_atom = gdk_x11_atom_to_xatom_for_display (display,
                                                                 opcode_atom);
 
       message_data_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA",
                                            FALSE);
+      manager->message_data_atom = gdk_x11_atom_to_xatom_for_display (display,
+                                                                      message_data_atom);
 
       /* Add a window filter */
 #if 0
@@ -745,22 +838,17 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
                         G_CALLBACK (na_tray_manager_selection_clear_event),
                         manager);
 #endif
-      /* This is for SYSTEM_TRAY_REQUEST_DOCK and SelectionClear */
-      gdk_window_add_filter (invisible->window,
+      gdk_window_add_filter (window,
                              na_tray_manager_window_filter, manager);
-      /* This is for SYSTEM_TRAY_BEGIN_MESSAGE and SYSTEM_TRAY_CANCEL_MESSAGE */
-      gdk_display_add_client_message_filter (display, opcode_atom,
-                                             na_tray_manager_handle_client_message_opcode,
-                                             manager);
-      /* This is for _NET_SYSTEM_TRAY_MESSAGE_DATA */
-      gdk_display_add_client_message_filter (display, message_data_atom,
-                                             na_tray_manager_handle_client_message_message_data,
-                                             manager);
       return TRUE;
     }
   else
     {
       gtk_widget_destroy (invisible);
+      g_object_unref (invisible);
+      manager->invisible = NULL;
+
+      manager->screen = NULL;
  
       return FALSE;
     }
@@ -819,80 +907,70 @@ na_tray_manager_check_running (GdkScreen *screen)
 #endif
 }
 
-char *
-na_tray_manager_get_child_title (NaTrayManager      *manager,
-				 NaTrayManagerChild *child)
+void
+na_tray_manager_set_orientation (NaTrayManager  *manager,
+				 GtkOrientation  orientation)
 {
-  char *retval = NULL;
-#ifdef GDK_WINDOWING_X11
-  GdkDisplay *display;
-  Window *child_window;
-  Atom utf8_string, atom, type;
-  int result;
-  int format;
-  gulong nitems;
-  gulong bytes_after;
-  gchar *val;
-
-  g_return_val_if_fail (NA_IS_TRAY_MANAGER (manager), NULL);
-  g_return_val_if_fail (GTK_IS_SOCKET (child), NULL);
-  
-  display = gdk_screen_get_display (manager->screen);
+  g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
 
-  child_window = g_object_get_data (G_OBJECT (child),
-				    "na-tray-child-window");
+  if (manager->orientation != orientation)
+    {
+      manager->orientation = orientation;
 
-  utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING");
-  atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME");
+      na_tray_manager_set_orientation_property (manager);
 
-  gdk_error_trap_push ();
+      g_object_notify (G_OBJECT (manager), "orientation");
+    }
+}
 
-  result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
-			       *child_window,
-			       atom,
-			       0, G_MAXLONG,
-			       False, utf8_string,
-			       &type, &format, &nitems,
-			       &bytes_after, (guchar **)(gpointer)&val);
-  
-  if (gdk_error_trap_pop () || result != Success)
-    return NULL;
+void
+na_tray_manager_set_padding (NaTrayManager *manager,
+                             gint           padding)
+{
+  g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
 
-  if (type != utf8_string ||
-      format != 8 ||
-      nitems == 0)
+  if (manager->padding != padding)
     {
-      if (val)
-	XFree (val);
-      return NULL;
-    }
+      manager->padding = padding;
 
-  if (!g_utf8_validate (val, nitems, NULL))
-    {
-      XFree (val);
-      return NULL;
+      na_tray_manager_set_padding_property (manager);
     }
+}
+
+void
+na_tray_manager_set_icon_size (NaTrayManager *manager,
+                               gint           icon_size)
+{
+  g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
 
-  retval = g_strndup (val, nitems);
+  if (manager->icon_size != icon_size)
+    {
+      manager->icon_size = icon_size;
 
-  XFree (val);
-#endif
-  return retval;
+      na_tray_manager_set_icon_size_property (manager);
+    }
 }
 
 void
-na_tray_manager_set_orientation (NaTrayManager  *manager,
-				 GtkOrientation  orientation)
+na_tray_manager_set_colors (NaTrayManager *manager,
+                            GdkColor      *fg,
+                            GdkColor      *error,
+                            GdkColor      *warning,
+                            GdkColor      *success)
 {
   g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
 
-  if (manager->orientation != orientation)
+  if (!gdk_color_equal (&manager->fg, fg) ||
+      !gdk_color_equal (&manager->error, error) ||
+      !gdk_color_equal (&manager->warning, warning) ||
+      !gdk_color_equal (&manager->success, success))
     {
-      manager->orientation = orientation;
+      manager->fg = *fg;
+      manager->error = *error;
+      manager->warning = *warning;
+      manager->success = *success;
 
-      na_tray_manager_set_orientation_property (manager);
-
-      g_object_notify (G_OBJECT (manager), "orientation");
+      na_tray_manager_set_colors_property (manager);
     }
 }
 
diff --git a/applets/systray/na-tray-manager.h b/applets/systray/na-tray-manager.h
index a1781a7..0408959 100644
--- a/applets/systray/na-tray-manager.h
+++ b/applets/systray/na-tray-manager.h
@@ -24,10 +24,12 @@
 #ifndef __NA_TRAY_MANAGER_H__
 #define __NA_TRAY_MANAGER_H__
 
-#include <gtk/gtk.h>
 #ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
 #endif
+#include <gtk/gtk.h>
+
+#include "na-tray-child.h"
 
 G_BEGIN_DECLS
 
@@ -40,7 +42,6 @@ G_BEGIN_DECLS
 	
 typedef struct _NaTrayManager	    NaTrayManager;
 typedef struct _NaTrayManagerClass  NaTrayManagerClass;
-typedef struct _NaTrayManagerChild  NaTrayManagerChild;
 
 struct _NaTrayManager
 {
@@ -49,11 +50,18 @@ struct _NaTrayManager
 #ifdef GDK_WINDOWING_X11
   GdkAtom selection_atom;
   Atom    opcode_atom;
+  Atom    message_data_atom;
 #endif
   
   GtkWidget *invisible;
   GdkScreen *screen;
   GtkOrientation orientation;
+  gint padding;
+  gint icon_size;
+  GdkColor fg;
+  GdkColor error;
+  GdkColor warning;
+  GdkColor success;
 
   GList *messages;
   GHashTable *socket_table;
@@ -64,18 +72,18 @@ struct _NaTrayManagerClass
   GObjectClass parent_class;
 
   void (* tray_icon_added)   (NaTrayManager      *manager,
-			      NaTrayManagerChild *child);
+			      NaTrayChild        *child);
   void (* tray_icon_removed) (NaTrayManager      *manager,
-			      NaTrayManagerChild *child);
+			      NaTrayChild        *child);
 
   void (* message_sent)      (NaTrayManager      *manager,
-			      NaTrayManagerChild *child,
+			      NaTrayChild        *child,
 			      const gchar        *message,
 			      glong               id,
 			      glong               timeout);
   
   void (* message_cancelled) (NaTrayManager      *manager,
-			      NaTrayManagerChild *child,
+			      NaTrayChild        *child,
 			      glong               id);
 
   void (* lost_selection)    (NaTrayManager      *manager);
@@ -87,11 +95,19 @@ gboolean        na_tray_manager_check_running   (GdkScreen          *screen);
 NaTrayManager  *na_tray_manager_new             (void);
 gboolean        na_tray_manager_manage_screen   (NaTrayManager      *manager,
 						 GdkScreen          *screen);
-char           *na_tray_manager_get_child_title (NaTrayManager      *manager,
-						 NaTrayManagerChild *child);
 void            na_tray_manager_set_orientation (NaTrayManager      *manager,
 						 GtkOrientation      orientation);
 GtkOrientation  na_tray_manager_get_orientation (NaTrayManager      *manager);
+void            na_tray_manager_set_padding     (NaTrayManager      *manager,
+						 gint                padding);
+void            na_tray_manager_set_icon_size   (NaTrayManager      *manager,
+						 gint                padding);
+void            na_tray_manager_set_colors      (NaTrayManager      *manager,
+						 GdkColor           *fg,
+						 GdkColor           *error,
+						 GdkColor           *warning,
+						 GdkColor           *success);
+
 
 G_END_DECLS
 
diff --git a/applets/systray/na-tray.c b/applets/systray/na-tray.c
new file mode 100644
index 0000000..7da908f
--- /dev/null
+++ b/applets/systray/na-tray.c
@@ -0,0 +1,863 @@
+/*
+ * Copyright (C) 2002 Red Hat, Inc.
+ * Copyright (C) 2003-2006 Vincent Untz
+ * Copyright (C) 2007 Christian Persch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include "na-tray-manager.h"
+#include "fixedtip.h"
+
+#include "na-tray.h"
+
+#define ICON_SPACING 1
+#define MIN_BOX_SIZE 3
+
+typedef struct
+{
+  NaTrayManager *tray_manager;
+  GSList        *all_trays;
+  GHashTable    *icon_table;
+  GHashTable    *tip_table;
+} TraysScreen;
+
+struct _NaTrayPrivate
+{
+  GdkScreen   *screen;
+  TraysScreen *trays_screen;
+
+  GtkWidget *box;
+  GtkWidget *frame;
+
+  guint idle_redraw_id;
+
+  GtkOrientation orientation;
+};
+
+typedef struct
+{
+  char  *text;
+  glong  id;
+  glong  timeout;
+} IconTipBuffer;
+
+typedef struct
+{
+  NaTray *tray;      /* tray containing the tray icon */
+  GtkWidget  *icon;      /* tray icon sending the message */
+  GtkWidget  *fixedtip;
+  guint       source_id;
+  glong       id;        /* id of the current message */
+  GSList     *buffer;    /* buffered messages */
+} IconTip;
+
+enum
+{
+  PROP_0,
+  PROP_ORIENTATION,
+  PROP_SCREEN
+};
+
+static gboolean     initialized   = FALSE;
+static TraysScreen *trays_screens = NULL;
+
+static void icon_tip_show_next (IconTip *icontip);
+
+/* NaTray */
+
+G_DEFINE_TYPE (NaTray, na_tray, GTK_TYPE_BIN)
+
+static NaTray *
+get_tray (TraysScreen *trays_screen)
+{
+  if (trays_screen->all_trays == NULL)
+    return NULL;
+  
+  return trays_screen->all_trays->data;
+}
+
+const char *ordered_roles[] = {
+  "keyboard",
+  "volume",
+  "bluetooth",
+  "network",
+  "battery",
+  NULL
+};
+
+const char *wmclass_roles[] = {
+  "Bluetooth-applet", "bluetooth",
+  "Gnome-volume-control-applet", "volume",
+  "Nm-applet", "network",
+  "Gnome-power-manager", "battery",
+  "keyboard", "keyboard",
+  NULL,
+};
+
+static const char *
+find_role (const char *wmclass)
+{
+  int i;
+
+  for (i = 0; wmclass_roles[i]; i += 2)
+    {
+      if (strcmp (wmclass, wmclass_roles[i]) == 0)
+        return wmclass_roles[i + 1];
+    }
+
+  return NULL;
+}
+
+static int
+find_role_position (const char *role)
+{
+  int i;
+
+  for (i = 0; ordered_roles[i]; i++)
+    {
+      if (strcmp (role, ordered_roles[i]) == 0)
+        break;
+    }
+
+  return i + 1;
+}
+
+static int
+find_icon_position (NaTray    *tray,
+                    GtkWidget *icon)
+{
+  NaTrayPrivate *priv;
+  int            position;
+  char          *class_a;
+  const char    *role;
+  int            role_position;
+  GList         *l, *children;
+
+  /* We insert the icons with a known roles in a specific order (the one
+   * defined by ordered_roles), and all other icons at the beginning of the box
+   * (left in LTR). */
+
+  priv = tray->priv;
+  position = 0;
+
+  class_a = NULL;
+  na_tray_child_get_wm_class (NA_TRAY_CHILD (icon), NULL, &class_a);
+  if (!class_a)
+    return position;
+
+  role = find_role (class_a);
+  g_free (class_a);
+  if (!role)
+    return position;
+
+  role_position = find_role_position (role);
+  g_object_set_data (G_OBJECT (icon), "role-position", GINT_TO_POINTER (role_position));
+
+  children = gtk_container_get_children (GTK_CONTAINER (priv->box));
+  for (l = g_list_last (children); l; l = l->prev)
+    {
+      GtkWidget *child = l->data;
+      int        rp;
+
+      rp = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "role-position"));
+      if (rp == 0 || rp < role_position)
+        {
+          position = g_list_index (children, child) + 1;
+          break;
+        }
+    }
+  g_list_free (children);
+
+  /* should never happen, but it doesn't hurt to be on the safe side */
+  if (position < 0)
+    position = 0;
+
+  return position;
+}
+
+static void
+tray_added (NaTrayManager *manager,
+            GtkWidget     *icon,
+            TraysScreen   *trays_screen)
+{
+  NaTray *tray;
+  NaTrayPrivate *priv;
+  int position;
+
+  tray = get_tray (trays_screen);
+  if (tray == NULL)
+    return;
+
+  priv = tray->priv;
+
+  g_assert (priv->trays_screen == trays_screen);
+
+  g_hash_table_insert (trays_screen->icon_table, icon, tray);
+
+  position = find_icon_position (tray, icon);
+  gtk_box_pack_start (GTK_BOX (priv->box), icon, FALSE, FALSE, 0);
+  gtk_box_reorder_child (GTK_BOX (priv->box), icon, position);
+
+  gtk_widget_show (icon);
+}
+
+static void
+tray_removed (NaTrayManager *manager,
+              GtkWidget     *icon,
+              TraysScreen   *trays_screen)
+{
+  NaTray *tray;
+  NaTrayPrivate *priv;
+
+  tray = g_hash_table_lookup (trays_screen->icon_table, icon);
+  if (tray == NULL)
+    return;
+
+  priv = tray->priv;
+
+  g_assert (tray->priv->trays_screen == trays_screen);
+
+  gtk_container_remove (GTK_CONTAINER (priv->box), icon);
+
+  g_hash_table_remove (trays_screen->icon_table, icon);
+  /* this will also destroy the tip associated to this icon */
+  g_hash_table_remove (trays_screen->tip_table, icon);
+}
+
+static void
+icon_tip_buffer_free (gpointer data,
+                      gpointer userdata)
+{
+  IconTipBuffer *buffer;
+
+  buffer = data;
+
+  g_free (buffer->text);
+  buffer->text = NULL;
+
+  g_free (buffer);
+}
+
+static void
+icon_tip_free (gpointer data)
+{
+  IconTip *icontip;
+
+  if (data == NULL)
+    return;
+
+  icontip = data;
+
+  if (icontip->fixedtip != NULL)
+    gtk_widget_destroy (GTK_WIDGET (icontip->fixedtip));
+  icontip->fixedtip = NULL;
+
+  if (icontip->source_id != 0)
+    g_source_remove (icontip->source_id);
+  icontip->source_id = 0;
+
+  if (icontip->buffer != NULL)
+    {
+      g_slist_foreach (icontip->buffer, icon_tip_buffer_free, NULL);
+      g_slist_free (icontip->buffer);
+    }
+  icontip->buffer = NULL;
+
+  g_free (icontip);
+}
+
+static int
+icon_tip_buffer_compare (gconstpointer a,
+                         gconstpointer b)
+{
+  const IconTipBuffer *buffer_a = a;
+  const IconTipBuffer *buffer_b = b;
+
+  if (buffer_a == NULL || buffer_b == NULL)
+    return !(buffer_a == buffer_b);
+
+  return buffer_a->id - buffer_b->id;
+}
+
+static void
+icon_tip_show_next_clicked (GtkWidget *widget,
+                            gpointer   data)
+{
+  icon_tip_show_next ((IconTip *) data);
+}
+
+static gboolean
+icon_tip_show_next_timeout (gpointer data)
+{
+  IconTip *icontip = (IconTip *) data;
+
+  icon_tip_show_next (icontip);
+
+  return FALSE;
+}
+
+static void
+icon_tip_show_next (IconTip *icontip)
+{
+  IconTipBuffer *buffer;
+
+  if (icontip->buffer == NULL)
+    {
+      /* this will also destroy the tip window */
+      g_hash_table_remove (icontip->tray->priv->trays_screen->tip_table,
+                           icontip->icon);
+      return;
+    }
+
+  if (icontip->source_id != 0)
+    g_source_remove (icontip->source_id);
+  icontip->source_id = 0;
+
+  buffer = icontip->buffer->data;
+  icontip->buffer = g_slist_remove (icontip->buffer, buffer);
+
+  if (icontip->fixedtip == NULL)
+    {
+      icontip->fixedtip = na_fixed_tip_new (icontip->icon,
+                                            na_tray_get_orientation (icontip->tray));
+
+      g_signal_connect (icontip->fixedtip, "clicked",
+                        G_CALLBACK (icon_tip_show_next_clicked), icontip);
+    }
+
+  na_fixed_tip_set_markup (icontip->fixedtip, buffer->text);
+
+  if (!gtk_widget_get_mapped (icontip->fixedtip))
+    gtk_widget_show (icontip->fixedtip);
+
+  icontip->id = buffer->id;
+
+  if (buffer->timeout > 0)
+    icontip->source_id = g_timeout_add_seconds (buffer->timeout,
+                                                icon_tip_show_next_timeout,
+                                                icontip);
+
+  icon_tip_buffer_free (buffer, NULL);
+}
+
+static void
+message_sent (NaTrayManager *manager,
+              GtkWidget     *icon,
+              const char    *text,
+              glong          id,
+              glong          timeout,
+              TraysScreen   *trays_screen)
+{
+  IconTip       *icontip;
+  IconTipBuffer  find_buffer;
+  IconTipBuffer *buffer;
+  gboolean       show_now;
+
+  icontip = g_hash_table_lookup (trays_screen->tip_table, icon);
+
+  find_buffer.id = id;
+  if (icontip && 
+      (icontip->id == id ||
+       g_slist_find_custom (icontip->buffer, &find_buffer,
+                            icon_tip_buffer_compare) != NULL))
+    /* we already have this message, so ignore it */
+    /* FIXME: in an ideal world, we'd remember all the past ids and ignore them
+     * too */
+    return;
+
+  show_now = FALSE;
+
+  if (icontip == NULL)
+    {
+      NaTray *tray;
+
+      tray = g_hash_table_lookup (trays_screen->icon_table, icon);
+      if (tray == NULL)
+        {
+          /* We don't know about the icon sending the message, so ignore it.
+           * But this should never happen since NaTrayManager shouldn't send
+           * us the message if there's no socket for it. */
+          g_critical ("Ignoring a message sent by a tray icon "
+                      "we don't know: \"%s\".\n", text);
+          return;
+        }
+
+      icontip = g_new0 (IconTip, 1);
+      icontip->tray = tray;
+      icontip->icon = icon;
+
+      g_hash_table_insert (trays_screen->tip_table, icon, icontip);
+
+      show_now = TRUE;
+    }
+
+  buffer = g_new0 (IconTipBuffer, 1);
+
+  buffer->text    = g_strdup (text);
+  buffer->id      = id;
+  buffer->timeout = timeout;
+
+  icontip->buffer = g_slist_append (icontip->buffer, buffer);
+
+  if (show_now)
+    icon_tip_show_next (icontip);
+}
+
+static void
+message_cancelled (NaTrayManager *manager,
+                   GtkWidget     *icon,
+                   glong          id,
+                   TraysScreen   *trays_screen)
+{
+  IconTip       *icontip;
+  IconTipBuffer  find_buffer;
+  GSList        *cancel_buffer_l;
+  IconTipBuffer *cancel_buffer;
+
+  icontip = g_hash_table_lookup (trays_screen->tip_table, icon);
+  if (icontip == NULL)
+    return;
+
+  if (icontip->id == id)
+    {
+      icon_tip_show_next (icontip);
+      return;
+    }
+
+  find_buffer.id = id;
+  cancel_buffer_l = g_slist_find_custom (icontip->buffer, &find_buffer,
+                                         icon_tip_buffer_compare);
+  if (cancel_buffer_l == NULL)
+    return;
+
+  cancel_buffer = cancel_buffer_l->data;
+  icon_tip_buffer_free (cancel_buffer, NULL);
+
+  icontip->buffer = g_slist_remove_link (icontip->buffer, cancel_buffer_l);
+  g_slist_free_1 (cancel_buffer_l);
+}
+
+static void
+update_orientation_for_messages (gpointer key,
+                                 gpointer value,
+                                 gpointer data)
+{
+  NaTray *tray;
+  IconTip    *icontip;
+
+  if (value == NULL)
+    return;
+
+  icontip = value;
+  tray    = data;
+  if (icontip->tray != tray)
+    return;
+
+  if (icontip->fixedtip)
+    na_fixed_tip_set_orientation (icontip->fixedtip, tray->priv->orientation);
+}
+
+static void
+update_size_and_orientation (NaTray *tray)
+{
+  NaTrayPrivate *priv = tray->priv;
+
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), priv->orientation);
+
+  /* This only happens when setting the property during object construction */
+  if (!priv->trays_screen)
+    return;
+
+  g_hash_table_foreach (priv->trays_screen->tip_table,
+                        update_orientation_for_messages, tray);
+
+  if (get_tray (priv->trays_screen) == tray)
+    na_tray_manager_set_orientation (priv->trays_screen->tray_manager,
+                                     priv->orientation);
+
+  /* note, you want this larger if the frame has non-NONE relief by default. */
+  switch (priv->orientation)
+    {
+    case GTK_ORIENTATION_VERTICAL:
+      /* Give box a min size so the frame doesn't look dumb */
+      gtk_widget_set_size_request (priv->box, MIN_BOX_SIZE, -1);
+      break;
+    case GTK_ORIENTATION_HORIZONTAL:
+      gtk_widget_set_size_request (priv->box, -1, MIN_BOX_SIZE);
+      break;
+    }
+}
+
+/* Children with alpha channels have been set to be composited by calling
+ * gdk_window_set_composited(). We need to paint these children ourselves.
+ */
+static void
+na_tray_draw_icon (GtkWidget *widget,
+		   gpointer   data)
+{
+  cairo_t *cr = (cairo_t *) data;
+
+  if (na_tray_child_has_alpha (NA_TRAY_CHILD (widget)))
+    {
+      GtkAllocation allocation;
+
+      gtk_widget_get_allocation (widget, &allocation);
+
+      cairo_save (cr);
+      gdk_cairo_set_source_window (cr,
+                                   gtk_widget_get_window (widget),
+				   allocation.x,
+				   allocation.y);
+      cairo_rectangle (cr, allocation.x, allocation.y, allocation.width, allocation.height);
+      cairo_clip (cr);
+      cairo_paint (cr);
+      cairo_restore (cr);
+    }
+}
+
+static void
+na_tray_draw_box (GtkWidget *box,
+		  cairo_t   *cr)
+{
+  gtk_container_foreach (GTK_CONTAINER (box), na_tray_draw_icon, cr);
+}
+
+static void
+na_tray_init (NaTray *tray)
+{
+  NaTrayPrivate *priv;
+
+  priv = tray->priv = G_TYPE_INSTANCE_GET_PRIVATE (tray, NA_TYPE_TRAY, NaTrayPrivate);
+
+  priv->screen = NULL;
+  priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+
+  priv->frame = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
+  gtk_container_add (GTK_CONTAINER (tray), priv->frame);
+  gtk_widget_show (priv->frame);
+
+  priv->box = gtk_box_new (priv->orientation, ICON_SPACING);
+  g_signal_connect (priv->box, "draw",
+                    G_CALLBACK (na_tray_draw_box), NULL);
+  gtk_container_add (GTK_CONTAINER (priv->frame), priv->box);
+  gtk_widget_show (priv->box);
+}
+
+static GObject *
+na_tray_constructor (GType type,
+                     guint n_construct_properties,
+                     GObjectConstructParam *construct_params)
+{
+  GObject *object;
+  NaTray *tray;
+  NaTrayPrivate *priv;
+  int screen_number;
+
+  object = G_OBJECT_CLASS (na_tray_parent_class)->constructor (type,
+                                                               n_construct_properties,
+                                                               construct_params);
+  tray = NA_TRAY (object);
+  priv = tray->priv;
+
+  g_assert (priv->screen != NULL);
+
+  if (!initialized)
+    {
+      GdkDisplay *display;
+      int n_screens;
+
+      display = gdk_display_get_default ();
+      n_screens = gdk_display_get_n_screens (display);
+      trays_screens = g_new0 (TraysScreen, n_screens);
+      initialized = TRUE;
+    }
+
+  screen_number = gdk_screen_get_number (priv->screen);
+
+  if (trays_screens [screen_number].tray_manager == NULL)
+    {
+      NaTrayManager *tray_manager;
+
+      tray_manager = na_tray_manager_new ();
+
+      if (na_tray_manager_manage_screen (tray_manager, priv->screen))
+        {
+          trays_screens [screen_number].tray_manager = tray_manager;
+
+          g_signal_connect (tray_manager, "tray_icon_added",
+                            G_CALLBACK (tray_added),
+                            &trays_screens [screen_number]);
+          g_signal_connect (tray_manager, "tray_icon_removed",
+                            G_CALLBACK (tray_removed),
+                            &trays_screens [screen_number]);
+          g_signal_connect (tray_manager, "message_sent",
+                            G_CALLBACK (message_sent),
+                            &trays_screens [screen_number]);
+          g_signal_connect (tray_manager, "message_cancelled",
+                            G_CALLBACK (message_cancelled),
+                            &trays_screens [screen_number]);
+
+          trays_screens [screen_number].icon_table = g_hash_table_new (NULL,
+                                                                       NULL);
+          trays_screens [screen_number].tip_table = g_hash_table_new_full (
+                                                                NULL,
+                                                                NULL,
+                                                                NULL,
+                                                                icon_tip_free);
+        }
+      else
+        {
+          g_printerr ("System tray didn't get the system tray manager selection for screen %d\n",
+		      screen_number);
+          g_object_unref (tray_manager);
+        }
+    }
+      
+  priv->trays_screen = &trays_screens [screen_number];
+  trays_screens [screen_number].all_trays = g_slist_append (trays_screens [screen_number].all_trays,
+                                                            tray);
+
+  update_size_and_orientation (tray);
+
+  return object;
+}
+
+static void
+na_tray_dispose (GObject *object)
+{
+  NaTray *tray = NA_TRAY (object);
+  NaTrayPrivate *priv = tray->priv;
+  TraysScreen *trays_screen = priv->trays_screen;
+
+  if (trays_screen != NULL)
+    {
+      trays_screen->all_trays = g_slist_remove (trays_screen->all_trays, tray);
+
+      if (trays_screen->all_trays == NULL)
+        {
+          /* Make sure we drop the manager selection */
+          g_object_unref (trays_screen->tray_manager);
+          trays_screen->tray_manager = NULL;
+
+          g_hash_table_destroy (trays_screen->icon_table);
+          trays_screen->icon_table = NULL;
+
+          g_hash_table_destroy (trays_screen->tip_table);
+          trays_screen->tip_table = NULL;
+        }
+      else
+        {
+          NaTray *new_tray;
+
+          new_tray = get_tray (trays_screen);
+          if (new_tray != NULL)
+            na_tray_manager_set_orientation (trays_screen->tray_manager,
+                                             na_tray_get_orientation (new_tray));
+        }
+    }
+
+  priv->trays_screen = NULL;
+
+  if (priv->idle_redraw_id != 0)
+    {
+      g_source_remove (priv->idle_redraw_id);
+      priv->idle_redraw_id = 0;
+    }
+
+  G_OBJECT_CLASS (na_tray_parent_class)->dispose (object);
+}
+
+static void
+na_tray_set_property (GObject      *object,
+		      guint         prop_id,
+		      const GValue *value,
+		      GParamSpec   *pspec)
+{
+  NaTray *tray = NA_TRAY (object);
+  NaTrayPrivate *priv = tray->priv;
+
+  switch (prop_id)
+    {
+    case PROP_ORIENTATION:
+      na_tray_set_orientation (tray, g_value_get_enum (value));
+      break;
+    case PROP_SCREEN:
+      priv->screen = g_value_get_object (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+na_tray_get_preferred_width (GtkWidget *widget,
+                             gint      *minimal_width,
+                             gint      *natural_width)
+{
+  gtk_widget_get_preferred_width (gtk_bin_get_child (GTK_BIN (widget)),
+                                  minimal_width,
+                                  natural_width);
+}
+
+static void
+na_tray_get_preferred_height (GtkWidget *widget,
+                              gint      *minimal_height,
+                              gint      *natural_height)
+{
+  gtk_widget_get_preferred_height (gtk_bin_get_child (GTK_BIN (widget)),
+                                   minimal_height,
+                                   natural_height);
+}
+
+static void
+na_tray_size_allocate (GtkWidget        *widget,
+                       GtkAllocation    *allocation)
+{
+  gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), allocation);
+  gtk_widget_set_allocation (widget, allocation);
+}
+
+static void
+na_tray_class_init (NaTrayClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gobject_class->constructor = na_tray_constructor;
+  gobject_class->set_property = na_tray_set_property;
+  gobject_class->dispose = na_tray_dispose;
+  widget_class->get_preferred_width = na_tray_get_preferred_width;
+  widget_class->get_preferred_height = na_tray_get_preferred_height;
+  widget_class->size_allocate = na_tray_size_allocate;
+
+  g_object_class_install_property
+    (gobject_class,
+     PROP_ORIENTATION,
+     g_param_spec_enum ("orientation", "orientation", "orientation",
+		        GTK_TYPE_ORIENTATION,
+			GTK_ORIENTATION_HORIZONTAL,
+			G_PARAM_WRITABLE |
+			G_PARAM_CONSTRUCT_ONLY |
+			G_PARAM_STATIC_NAME |
+			G_PARAM_STATIC_NICK |
+			G_PARAM_STATIC_BLURB));
+  
+  g_object_class_install_property
+    (gobject_class,
+     PROP_SCREEN,
+     g_param_spec_object ("screen", "screen", "screen",
+			  GDK_TYPE_SCREEN,
+			  G_PARAM_WRITABLE |
+			  G_PARAM_CONSTRUCT_ONLY |
+			  G_PARAM_STATIC_NAME |
+			  G_PARAM_STATIC_NICK |
+			  G_PARAM_STATIC_BLURB));
+
+  g_type_class_add_private (gobject_class, sizeof (NaTrayPrivate));
+}
+
+NaTray *
+na_tray_new_for_screen (GdkScreen      *screen,
+		        GtkOrientation  orientation)
+{
+  return g_object_new (NA_TYPE_TRAY,
+		       "screen", screen,
+		       "orientation", orientation,
+		       NULL);
+}
+
+void
+na_tray_set_orientation (NaTray         *tray,
+			 GtkOrientation  orientation)
+{
+  NaTrayPrivate *priv = tray->priv;
+
+  if (orientation == priv->orientation)
+    return;
+  
+  priv->orientation = orientation;
+
+  update_size_and_orientation (tray);
+}
+
+GtkOrientation
+na_tray_get_orientation (NaTray *tray)
+{
+  return tray->priv->orientation;
+}
+
+static gboolean
+idle_redraw_cb (NaTray *tray)
+{
+  NaTrayPrivate *priv = tray->priv;
+
+  gtk_container_foreach (GTK_CONTAINER (priv->box), (GtkCallback)na_tray_child_force_redraw, tray);
+  
+  priv->idle_redraw_id = 0;
+
+  return FALSE;
+}
+
+void
+na_tray_set_padding (NaTray *tray,
+                     gint    padding)
+{
+  NaTrayPrivate *priv = tray->priv;
+
+  if (get_tray (priv->trays_screen) == tray)
+    na_tray_manager_set_padding (priv->trays_screen->tray_manager, padding);
+}
+
+void
+na_tray_set_icon_size (NaTray *tray,
+                       gint    size)
+{
+  NaTrayPrivate *priv = tray->priv;
+
+  if (get_tray (priv->trays_screen) == tray)
+    na_tray_manager_set_icon_size (priv->trays_screen->tray_manager, size);
+}
+
+void
+na_tray_set_colors (NaTray   *tray,
+                    GdkColor *fg,
+                    GdkColor *error,
+                    GdkColor *warning,
+                    GdkColor *success)
+{
+  NaTrayPrivate *priv = tray->priv;
+
+  if (get_tray (priv->trays_screen) == tray)
+    na_tray_manager_set_colors (priv->trays_screen->tray_manager, fg, error, warning, success);
+}
+
+void
+na_tray_force_redraw (NaTray *tray)
+{
+  NaTrayPrivate *priv = tray->priv;
+
+  /* Force the icons to redraw their backgrounds.
+   */
+  if (priv->idle_redraw_id == 0)
+    priv->idle_redraw_id = g_idle_add ((GSourceFunc) idle_redraw_cb, tray);
+}
diff --git a/applets/systray/na-tray.h b/applets/systray/na-tray.h
new file mode 100644
index 0000000..8fd7db4
--- /dev/null
+++ b/applets/systray/na-tray.h
@@ -0,0 +1,76 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* na-tray-tray.h
+ * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
+ * Copyright (C) 2003-2006 Vincent Untz
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Used to be: eggtraytray.h
+ */
+
+#ifndef __NA_TRAY_H__
+#define __NA_TRAY_H__
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define NA_TYPE_TRAY			(na_tray_get_type ())
+#define NA_TRAY(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_TRAY, NaTray))
+#define NA_TRAY_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_TRAY, NaTrayClass))
+#define NA_IS_TRAY(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_TRAY))
+#define NA_IS_TRAY_CLASS(klass)		(G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_TRAY))
+#define NA_TRAY_GET_CLASS(obj)		(G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_TRAY, NaTrayClass))
+	
+typedef struct _NaTray		NaTray;
+typedef struct _NaTrayPrivate	NaTrayPrivate;
+typedef struct _NaTrayClass	NaTrayClass;
+
+struct _NaTray
+{
+  GtkBin parent_instance;
+
+  NaTrayPrivate *priv;
+};
+
+struct _NaTrayClass
+{
+  GtkBinClass parent_class;
+};
+
+GType           na_tray_get_type        (void);
+NaTray         *na_tray_new_for_screen  (GdkScreen     *screen,
+					 GtkOrientation orientation);
+void            na_tray_set_orientation	(NaTray        *tray,
+					 GtkOrientation orientation);
+GtkOrientation  na_tray_get_orientation (NaTray        *tray);
+void            na_tray_set_padding     (NaTray        *tray,
+					 gint           padding);
+void            na_tray_set_icon_size   (NaTray        *tray,
+					 gint           icon_size);
+void            na_tray_set_colors      (NaTray        *tray,
+					 GdkColor      *fg,
+					 GdkColor      *error,
+					 GdkColor      *warning,
+					 GdkColor      *success);
+void		na_tray_force_redraw	(NaTray        *tray);
+
+G_END_DECLS
+
+#endif /* __NA_TRAY_H__ */
diff --git a/applets/systray/systray.c b/applets/systray/systray.c
index 71736dc..39698a8 100644
--- a/applets/systray/systray.c
+++ b/applets/systray/systray.c
@@ -1,7 +1,9 @@
-/* 
- * (C) 2006 OpenedHand Ltd.
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * (C) 2006-2013 Intel Corp
  *
  * Author: Jorn Baayen <jorn@openedhand.com>
+ *         Ross Burton <ross.burton@intel.com>
  *
  * Licensed under the GPL v2 or greater.
  */
@@ -10,98 +12,39 @@
 #include <gtk/gtk.h>
 #include <matchbox-panel/mb-panel.h>
 
-#include "na-tray-manager.h"
-
-/* We need to force the redraw like this because gtk_widget_queue_draw ()
- * doesn't help.
- */
+#include "na-tray.h"
 
 static void
-force_icon_redraw (GtkWidget *box)
+on_realize (GtkWidget *widget, gpointer user_data)
 {
-       gtk_widget_hide (box);
-       gtk_widget_show (box);
-}
+  GdkScreen *screen;
+  GtkWidget *tray;
+  GtkOrientation orientation;
 
-static void
-style_set_cb (GtkWidget *widget, 
-              GtkStyle  *old_style, 
-              gpointer  user_data)
-{
-        force_icon_redraw (widget);
-}
+  screen = gtk_widget_get_screen (widget);
 
-/* Tray icon added */
-static void
-tray_icon_added_cb (NaTrayManager *manager,
-                    GtkWidget      *icon,
-                    GtkBox         *box)
-{
-        gtk_box_pack_start (box, icon, FALSE, FALSE, 0);
-        force_icon_redraw (GTK_WIDGET (box));
-}
+  /* Bit ugly but works to save passing a struct */
+  orientation = GPOINTER_TO_INT (user_data);
 
-/* Screen changed */
-static void
-screen_changed_cb (GtkWidget      *widget,
-                   GdkScreen      *old_screen,
-                   NaTrayManager *manager)
-{
-        GdkScreen *screen;
-
-        screen = gtk_widget_get_screen (widget);
-        if (na_tray_manager_check_running (screen)) {
-                g_warning ("Another system tray manager is running. "
-                           "Not managing screen.");
-
-                return;
-        }
+  tray = (GtkWidget *)na_tray_new_for_screen (screen, orientation);
 
-        na_tray_manager_manage_screen (manager, screen);
+  gtk_widget_show (tray);
 
-        force_icon_redraw (widget);
+  gtk_container_add (GTK_CONTAINER (widget), tray);
 }
 
 G_MODULE_EXPORT GtkWidget *
 mb_panel_applet_create (const char    *id,
                         GtkOrientation orientation)
 {
-        NaTrayManager *manager;
         GtkWidget *box;
 
-        /* Is this a horizontal panel? */
-        if (orientation == GTK_ORIENTATION_HORIZONTAL)
-                box = gtk_hbox_new (0, FALSE);
-        else
-                box = gtk_vbox_new (0, FALSE);
+        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
         gtk_widget_set_name (box, "MatchboxPanelSystemTray");
 
-        /* Create tray manager */
-        manager = na_tray_manager_new ();
-        na_tray_manager_set_orientation (manager, orientation);
-
-        g_signal_connect (manager,
-                          "tray-icon-added",
-                          G_CALLBACK (tray_icon_added_cb),
-                          box);
-
-        g_signal_connect (box,
-                          "screen-changed",
-                          G_CALLBACK (screen_changed_cb),
-                          manager);
-
-        g_signal_connect (box,
-                          "style-set",
-                          G_CALLBACK (style_set_cb),
-                          NULL);
-
+        g_signal_connect (box, "realize", G_CALLBACK (on_realize), GINT_TO_POINTER (orientation));
 
-        g_object_weak_ref (G_OBJECT (box),
-                           (GWeakNotify) g_object_unref,
-                           manager);
-        
-        /* Show! */
         gtk_widget_show (box);
 
         return box;
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 10/25] data: ship our own icons here instead of in sato-icon-theme
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (8 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 09/25] systray: " Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 11/25] po: update POTFILES.in Jussi Kukkonen
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 Makefile.am                        |   2 +-
 configure.ac                       |   1 +
 data/16x16/panel-task-switcher.png | Bin 0 -> 432 bytes
 data/16x16/panel-user-desktop.png  | Bin 0 -> 393 bytes
 data/22x22/panel-task-switcher.png | Bin 0 -> 636 bytes
 data/22x22/panel-user-desktop.png  | Bin 0 -> 517 bytes
 data/32x32/panel-task-switcher.png | Bin 0 -> 965 bytes
 data/32x32/panel-user-desktop.png  | Bin 0 -> 734 bytes
 data/48x48/panel-task-switcher.png | Bin 0 -> 1588 bytes
 data/48x48/panel-user-desktop.png  | Bin 0 -> 1115 bytes
 data/64x64/panel-task-switcher.png | Bin 0 -> 2328 bytes
 data/64x64/panel-user-desktop.png  | Bin 0 -> 1491 bytes
 data/Makefile.am                   |  18 ++++++++++++++++++
 13 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 data/16x16/panel-task-switcher.png
 create mode 100644 data/16x16/panel-user-desktop.png
 create mode 100644 data/22x22/panel-task-switcher.png
 create mode 100644 data/22x22/panel-user-desktop.png
 create mode 100644 data/32x32/panel-task-switcher.png
 create mode 100644 data/32x32/panel-user-desktop.png
 create mode 100644 data/48x48/panel-task-switcher.png
 create mode 100644 data/48x48/panel-user-desktop.png
 create mode 100644 data/64x64/panel-task-switcher.png
 create mode 100644 data/64x64/panel-user-desktop.png
 create mode 100644 data/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index 68f2e0a..87db93c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = matchbox-panel applets po
+SUBDIRS = matchbox-panel applets data po
 
 pcdatadir = $(libdir)/pkgconfig
 dist_pcdata_DATA= matchbox-panel.pc
diff --git a/configure.ac b/configure.ac
index 4f38032..101df2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,6 +105,7 @@ applets/startup/Makefile
 applets/startup/data/Makefile
 applets/systray/Makefile
 applets/windowselector/Makefile
+data/Makefile
 po/Makefile.in
 po/Makefile
 ])
diff --git a/data/16x16/panel-task-switcher.png b/data/16x16/panel-task-switcher.png
new file mode 100644
index 0000000000000000000000000000000000000000..1bc5a70aa1ad13423f552594f5aff1c6b0de924e
GIT binary patch
literal 432
zcmV;h0Z;ykP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004b3#c}2nYxW
zd<bNS0004JNkl<ZIE|H(Jt&1?6vuz}dL+uq!e%kaD5F8?c5{8)e18lUSu98vrAW%G
z6kRTouZ5H{F&Je~vM~ADBp-492JgLHuN$wkJkN8^|NNeFIw#cC+i?RF^V5!i4?w^J
zFaS&dd%$sGVfhXq)Y;R14xDEJ+-BTMfkhzU0bhYpV9uG@S~9UZo&}J$_O8}`ucBt)
z1n2{1fm<i(w_E^Hnw6!sUC%Yy*4a`9jD&*%{5nbdk}CdHfzS5}<T+UYKo*Tm&%k3S
z-qJJ;%=qH@KsQj}y(@tW;0bsELVyEuoyi`6IPjhUC;^5&VajT}GwFSh1LQkNV?g8P
z`u0Ie*%*&i0QbP*AKeW&nF>9kzvrv1jh(aKvKyM}@0_GJAnzL>z+_Uou%uH-wf;cR
z@j8=D0m*1AatX`>RVKR*Qh~_`%d{=ipiDzDUCFdAQ+3e&NRKHJtt$emfe2rFF#`Nm
aN%<$NIkriwwAldw0000<MNUMnLSTX=Bf2dB

literal 0
HcmV?d00001

diff --git a/data/16x16/panel-user-desktop.png b/data/16x16/panel-user-desktop.png
new file mode 100644
index 0000000000000000000000000000000000000000..69c09ddbd369815b569668214a53fd3bc793c771
GIT binary patch
literal 393
zcmV;40e1e0P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004b3#c}2nYxW
zd<bNS0003%Nkl<ZIE|H(KTASk6vlt|CP5Sx1a8&lsBJ|}Ev-RNYW~4KL37_lNGwT1
z4V&!)ghoR{?QJbB;&SPITJDv5^}du3Ja9Pgdw!gAI1Uz-FN(`R4Ojrm_3PVF+&?ES
zS*jG)fhKU|r=EZ;a0qZyYjmuDLOGuVy1;(uUBEN20ek~{jryGc65-<WQf^byBaoSb
zJHW0V55hHW5af&5l%&3-j3h@AQ+9lBOG-sX$Q90ZfF7_Fx04us0>{n9{i~DBpC0%#
zC;wR-=nFVWNU8#>a~1=v0ae$?q>ap_kzr0>8JV=(Zgo9LUd+<|ve#~Py##=a!mY`7
zAP39Afqw^51n>b=00S%nePGE3a05WdV@ZRDPH!mbMbeLLj7bMZCYEl?&yEn?!9=$F
nEI@h(M!-r0AS+-DyaD_IPy70bPU!X000000NkvXXu0mjf@z0=P

literal 0
HcmV?d00001

diff --git a/data/22x22/panel-task-switcher.png b/data/22x22/panel-task-switcher.png
new file mode 100644
index 0000000000000000000000000000000000000000..d19020e71ecbe2653219e8def1af8c7cb76574d4
GIT binary patch
literal 636
zcmV-?0)zdDP)<h;3K|Lk000e1NJLTq000&M000&U1^@s6#I$TX00004b3#c}2nYxW
zd<bNS0006rNkl<ZIE}59OGs5w6o$WhJcvb5Gt0~d;UF7C6a+yvhz6CK7a#b3KvB@B
zNwWq)gP>8+BpOKOD<52~6lxMQi9qN<6eL83gP@sILZ)AXbFSR<UN!B9%{hCowf_B|
zwf9;l(c01c4k!Z>WXBxv0@wxo0=@yCfp(w*C<X2UGhLnC3+bRhEmJW!X4P@^gZf5&
zsurt9)lT)gI;jq{v^O106Nl;qa04)h;xs;{#Q;ZuFTf`tKaQ;ePBgbQUhKZt`ykQO
z+K}q$>PxOdx`?LMh5+aT+JHi!1egGl!0mXG<Dsr5^lxPP_ulWH0;bZ_#+Ld5qI_Qt
zR!zV%=8Uo2HiS$gCxi7UPLC|MS#?@1+E6O8*aYT*ywHEl#Y+AeHrJ%MuAyeJc+?<%
z4Kmkb+XC<$m<iQ_+WP7evL8nta7o>lv6cY#11X}<2ABah5mjaam<-itz?B@t`9L$U
zIg4#a{QL=Y01d$FcwQf>hk^IQ1F5S^BdhC@+kiuHKrRRzBkCbL<F&#NNdm>ywaIJ4
zgQ?%kLf{o}et0mo=2Nb&O^$|YuCBJ?)mjNEp*m00Se9+DQR1(_cA`_A`(MO?`a~^K
zYqB}yD&MszzD3kaZ&p^7{{TjS1HiQUecg&5jy!%VUJwJZM|>&X5l6*ham6yuN{j>m
zk4DCZkW<JQvK!fplp=fL7Mb(rEJelHGYMRB6Ur-32f$X~9MNxQ9Ox(VTdV8@u;mYy
W)l~F47I2vW0000<MNUMnLSTX&+#Hqw

literal 0
HcmV?d00001

diff --git a/data/22x22/panel-user-desktop.png b/data/22x22/panel-user-desktop.png
new file mode 100644
index 0000000000000000000000000000000000000000..e2b03669785bdc34ab756f48babd902eb550cd0d
GIT binary patch
literal 517
zcmV+g0{Z=lP)<h;3K|Lk000e1NJLTq000&M000&U1^@s6#I$TX00004b3#c}2nYxW
zd<bNS0005JNkl<ZIE}rNze`(D7>1u4uS0AXK@f*l=unp$(!oJ-YQeEcpiR6<G(wAm
zlmCI6I4U>@Ld9rnVn}O);Nn!;p<8Q<q-(*!QK1nrc^z_<n;+hLHR20rIQM+-bMAM}
zdklPNd@|7qtN}s5T6@2K<mEBE3X-XKH?R)8v_E|VqUqI*!(=LM*bJptH{|rSxj_>X
z)??rkFl+-1;1Td56z<;xrho;Y>(|fyuTHOd9W*{Z_Eb_92-S6F0AZj2`~#i?KkEHW
z!B#RBmXrgY(EPXzpwAvn)d02<u_44qsx7<Sfpe{aQ**{+@#qMU1$sQ7_3G^pJv;cl
z|L1SRt}*LP1Xuw&Zvb@a7<dchHa}!#M6K5WAPFo14{iy))PG<GSTQ9{1M^hF->N!*
zMIdNOngY&%c3k4;Q)S>3cxOr)u%WxaV2j`))yH%i$Yt^+NhgxZl4x;MB%S0k`BJrY
zx&FniWCBP{$=7Y?E8lM5??BoyZwKaphpmE(pYvaqFDIjsS3zL*F2FVNQ*)1CAF=RL
z(*U+T6%Vo>T`>Xxh3y?l+LBaq2EK;t{W#7fZ5Fn7&H*j}T=(tR8psOW00000NkvXX
Hu0mjfG3nqU

literal 0
HcmV?d00001

diff --git a/data/32x32/panel-task-switcher.png b/data/32x32/panel-task-switcher.png
new file mode 100644
index 0000000000000000000000000000000000000000..c06fc3ffd6c61c5ffc2d539148993c266c823b89
GIT binary patch
literal 965
zcmV;$13LVPP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F800004b3#c}2nYxW
zd<bNS000AgNkl<ZScSFMPl(iI7zgmr%#LLKOQqDU4q66whz{kcyhKpy?Bw9CnX79e
zRL~(xio$~tNDu|lt<2PQ*A*AjQY*@c@={<4b?8u8r%)>Y5*fQQPlxv>P227`!;IgT
zIXuJre&6r!c^|&d`{w#KtR2P*6f}mwSxmzSs+f!mIDzi|9Ruh4HmqHM&3G2)`gaV(
zcx1VCkM@o<u{oT>{dg+d@I1P(1;gmZMeM?z_yj-V7>@1UIe2lbfGR54mo<VB9Kd3n
z#wFZ_FR%>D@dVZ*pRI{(-U+;fqq}zwRv@=_{hB}VLZ-SEOvWbkU>>$(7XH9>n1Y;i
ze4Fw1z^*-`x!%4<&SL&x|IqnXcJJ+bWEwuj<M>v}#?x4b8>Nh_mulw%Hsam<xNI$A
zuz#qE5AYaH5B3io$1_=c4l}S7orQ=-kG?*}@?;`@s)<L|tXn;dg;K%Zik`gCc=^>;
zQ1hDrdv@=w2-}5ILWj_m4{5Z%|G(o3^Uj3$Iz%qS9R+PVf`)k_D)=pnW*6GDeZx77
zG_{(Ag{xMCjm|5yr2uIv1+`J39R-+p8_a;H;%CX4Pd1f-Rja#mlD$qFhj}WlLFcN~
z-Dm13fFt+|$8tRnulyZl$)T=<`FK_G`tdL|Bd*r`H;Pl3EA@eEr6zR&-xor>gO{a7
zaV6X!IaoalADf-y=*2e4e(%9_sdax;5C-raj%KRrp%-s7DE2ZI;6*Hwno}nxNiBRz
zA;jLANw4hRcVNP*Sh=cv313RBw$g+MI6Nkvh5HJ^BI%26ky1M`agz1}hV~C17;RF(
zf3UKrJO^6~5z%lu+htm{Tuu2vyF8<os~}X+p?+mwUe!KiT=|GN8xbPn`iSVLyC%(R
z%TZkB$xHXQz+IT#GINv2N5r9ss6<3(L~MMh+%;hqu1W?%42L)wq9eqn5Iv=GaT1iu
z#g0<BxUf_%=4kxZ(~y8{<b_{_&B8@trtqflT4_b`ZegCVLs(W?QOq@R?`uK<LH_-N
zha(~mM#S@3K~9f|CnMssi1;cZ7DvRkh<Gp}a#y1W9eVG`DBi*v$!h<WI@?WBi=8XI
z`6jiz^BDZk1&gI+GjK1KNO$-L@Qw7USt7l7o|E2)tzZs5pU{SvcP-6fCSJ#uBZofx
nWqH@q+p!Nfk0-uKRPpgY+n=R^VpR)L00000NkvXXu0mjfDxK4$

literal 0
HcmV?d00001

diff --git a/data/32x32/panel-user-desktop.png b/data/32x32/panel-user-desktop.png
new file mode 100644
index 0000000000000000000000000000000000000000..dfc3df3ea91782627e6eafac9d8af57ab1384913
GIT binary patch
literal 734
zcmV<40wMj0P)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F800004b3#c}2nYxW
zd<bNS0007&Nkl<ZScS#aPiS0K6bA6$Bx9NetXidof(5bQVkT)fb)j@oQ0%H`X#PxQ
z5+lW~y6MI)gmxw9LTSN8sTJF_6;UY?N>^^GP}Gg$B(b=0s|c=av`v%K#hb?G^o2>@
zOqvfaJl=WteBV3wobMLo#Kar5T{wqFaCqvIOE>f6>CUrhe6m``1-yW#@#5}11K<Dr
zQ~md~<|^bM-;0k?PVEoe#9@4Q@%-f&pRD$v*ofb~c>eO8wgl8(A1h#=r0lyg_6B~#
zo4Af+7;416zz3Hue7e+}x7hq53)P8AS46ymGm?^L2`}IoOyOwb`T0idhm~@-6i}V0
zbmKLAh;1v7r$y|*NBE;v?v?_^#z%`0QN#Oqq6K+c#FLGcU%*&xv`09Cckt*c$<rcM
zg-ijJ+DLDRV|W{VYb4LYcJyMtIq-lFRI0;$IDz9GB8O+u*FR9YF;kyiSW&=eb$AQj
zm2~l@4iMi*5qt4ed7$*|OnvtD0|G|IhPL7~CehPD@-){T>@4?}uFuxz{#h0<QW@GV
zneicsx33qvQNnZO{?a$IGjo3zhAW45;w)a0^KQt2MSP7TMPW)}v0V>|oa9Ge##AvP
z<|VGxg~xTa`LeKpzp#Y)Vu(RW)Aiyr>|bXAzu*9F;m-1m9~vI)#k8a}>xmz+@5|4x
z+#=<KA=a5U8~<7H#_*>q5F1>97DuquSj{L%rYHA(vDzcJA(@b75u0%mTiO=T;t1w&
z=Bq2yi|LoI4jz0AZ?z-fVY*)?+G@g1G;Uiy&<XEo&j&g%xf^~28_|USQ=P8BBK~ZA
zuqtE8QGt+L{mbLLT!E|8*A^n;R7BJxf##JZU=1rG;@60H@9OlmfA8nG2i-RIy0D@j
QEdT%j07*qoM6N<$f>G0J4gdfE

literal 0
HcmV?d00001

diff --git a/data/48x48/panel-task-switcher.png b/data/48x48/panel-task-switcher.png
new file mode 100644
index 0000000000000000000000000000000000000000..dfe84ae98a6191be722a1b605baa00a075866d04
GIT binary patch
literal 1588
zcmV-42Fv-0P)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00004b3#c}2nYxW
zd<bNS000H+Nkl<ZXo1z*e~esJ6$kLo%)HXpQrk_1XjKG*B!aX^O)97r6Oh<Whu!TD
z+HQYgOfVWk{7KX(G1jJ_)!0AONVIm@?E*r7Zh>ec(S#@oi9b+O(h$@LEmTE*v<vO-
z@sImvceX$1?(FU?`<=YZy!-CE=bn4M=e~2!o5I=~R^Nm#Vm6BEL!gj<_o7tO9yR0k
z;w9XHjqO`Io`<zJtj=&1T5)Up){f_fDmaUXFW{|pPP~fh<R8O>n2&kbg%`0LPvZf6
z0IRVBzg@GwtrQXSu>ogc&YJaYPvRhY?)+(Iyr$qa>)U$s2^2=CL@&OJZ(s>Nk5Aw*
zevF54J3fxj;gi^h_hS>T#8Lb`SNaeh#r^mzj+{!F(%j4De0>xq&wv&Bun==4x}2Y%
z&%mp=7VpGv9LtsZkVLbyaE`=?izG`f#M^Li?qzch|MB;a^$ilbdflqP3;1^~d?cuH
zzG~6xc*UA)O~|kwf5Z2&z{&nsUDT>y{TbgxcgMEvN2{H(yu(iXU=$P>3KmN=f&&uw
zZ^L`>vg9i>Fdb7R#WGwfS*vOFx>cPW+qS<<a^eF1+1cLpNCPIXZSBf;OVlB)?5}YP
zHlqhO;yA8AOa9%IEAkF}8Hd}}uH4<(-ql<0wmB;3Z10NB_O9djmE_pJkQVcC`~++8
z6^Uw9cDx;5l`PWF&2dF%dsnZd#1_dPtIGWsTO|t}$h#MDG1}VJuAE+_P{R;$>h;Q%
zIDCrsS5~cA@pGJu??}Ee35#&|xKe1S*na0-J?O?S4eWC7!j;8HXxL;TqW>7?ea}Y3
z{)l)fzrPd_R~3!ULu|~^)p2*96sjDoX}&mXxC@U&UN|Io@*Ho;LIe4O7=Z>Mjv9D|
zz_bZNp&Yf^7f_mL6gmkLjY222Wun0p8UqWAV8nXnFd_>alLEc!AU&^(SZEmd5B?-&
zY(02r)F`xk#nOTlqrCQb(cfp%@)b*`7|sHwo?E1Ja}w?v6(?S{V#(Pdu9HIC><ry6
z!AvQ!ze0TsDByWyg=N<-c@cZ1Qb)ZR*?in2<+3BOXf^G8E}!6eQuzFo6otN7qS3Qb
zp8QA_;yx)SeV_XMp$W4_IC%zEb_4d~TbLqcVdvpTQq^NWzJ``exJ9bf%v8TQTXBt4
zRj7u$>ijJqXPUJ7rTl!Vl!8vqj|`JCoGq0;`mpQXdv-iEoY^m3-dezg_=v%kh<Y&v
zpThN0%wNFwa)qYn*OpbUWg#}<qq*SsELq<2>HF^4`N~kG)$Hs4!$Z;zF<N-|H0>qH
zI`cANk)$=r58i}-4Ozqh=?-Ee{!+(8hl>(!#k?%U)S9VO`8H(KSRl~1<7d0ZytdT3
zthrhRR2z-fw}XtwbG$}o@zl)|2iZsy`bHK6P9?J_?LM`8@kGkdWFd}7du&J#hsnbk
zpwZ#@i871Aq5cRYOcl-@=4gYDMxaJsQL4LFDKrb0Hn&zLM8yt@d9|xIuXas~h-)HZ
z_D~0?t+X}Dp=;$8@f$puUn}6lC|}pIc<O0Kcpae_;)xLZLcAJ6h&P7#Oo*#1E#*N^
z<w{GrP-!X8thAK-DHbPu8i87Q#XUQ_Ul2Nk-wA!Wb6hBF7S>go%d;xY<wAbvG~s4p
zL8ZA|%G<`>iAhD%+wqV5yeNgp8}LK4Rhr8eNP*tf(mSmMmFDu9(#J7J5%%orJ{}Pd
zM#QFwcse5bBBBrx=R`zvL~O~O{oaVUBqA=4h}$CKgL#>IT%8!~-M#M!w&An*gH(SZ
zJ=~gb0WOy^w^IIlqm)>T8wTz7dw1{aiHMyMabrZ>5fRTsL{DxJxm5}^zq6Y2@vuOg
z#NqBe_a7@)7Cwq6uw8l=HD7v1^#-XjFd2_a3HAX4f9S}{m4&4f#~cG>xx6z6Zsp3t
zqLi`CmR@mg&M$pQdS`VUH|NKGqnlEm4n?Vwa{jO)&qa$rHUr<5{%Nv*-`)p~<?R<q
mC6H?kGZ?G`Rh~YB&Ho2I39$Z%K(NsO0000<MNUMnLSTab#u=*s

literal 0
HcmV?d00001

diff --git a/data/48x48/panel-user-desktop.png b/data/48x48/panel-user-desktop.png
new file mode 100644
index 0000000000000000000000000000000000000000..12c4b5c94af993c5f27cfa0670749b686940bd89
GIT binary patch
literal 1115
zcmV-h1f=_kP)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00004b3#c}2nYxW
zd<bNS000CMNkl<ZXo20?TZmOv7zgm*)|u42mSTocL<H5$oSCAch$w=nhpslx%$YM6
zC7~X|iijd2t?c5HP!ai5#vmjnB_X}^(tBjig)%9#gd))L5?VQ{hjm6r=bSU=%-J)Z
z=?@3?-fOMz`~Ua)zO}w}c489Hv%0Guci<Jw#Y_17!}t46rtNEH+6KE<<?3)3-o%Yq
zie~)Q+>+V1XLtXpH2tM2pnFxW9{1r@v|t7jEXm&=X>Q33r70pc0o|)|v+)RCMx#hP
z$u}psNEGpBb4%vCJ-hq=NyBe4ewXpl)!R7-IlPF=OV|zg6`QcRZ_CyrUA>(NmgDA8
z;{v|M{=O|+Ln+^NDUhFsNAdJH<mKCz;Tg>B>h0WwW4Hlti6KW6@Em@|zoq<FB_P+6
zT^K@m9BcE$%9+tbOzbD}*Y9CYe*8#C59gnaYj45=ay{9_BJs6YSdOz%NN}+@YfG?i
zqC6%fAlH*!hG(%_<>W_@U><sL(3$Y52o(wF?CwagJcRH(x-nmM3qgVlarHzER5}A!
z;RST!0_m(`RoN&@K(?zr!L=cTb+})8<g3QG0<vB0GthtyxX09ypRbI(D7h17bL|Ok
z#T&R+6g*XLei43b$~68k&_7tTQ&9mOxwe_O6R+X+eBY@epWsq)<_|Px8h#q+9~>^!
zv7msCT-!)Fyiu$utKP9EfEl<1860fPH0&Sf9~@HzjuFt&*;bDS#d0`PsLvE)M8r)v
z+}PAGbgqcA$hCK_oQ-y@$2BInxulFl%!ljoM`KgN-ogH%)0OOL0qxn9bI~f+@>i-2
z@*_yFKn&+2jZF=E2M2~uk{8gHZC!vhScl8h7Wok*;?jBxG&EiJ&EUY$$)qjYx)_g%
zMcGm{vO$$Vz#+Vick2XCilyx$wNIWimF!cPRTqRcB6*^^(H(0Ag-&G)vARz10Uj0)
z5HMR*SU)w~%EmAb<9Po51U{_`!s~d)nZ&(K+`z7wa*D-~h)2&2_&EP;7)R^2f3)LR
zz7e#xt@zzI=g{+jAQC>becO&-MmN;ra#<0^)HtDFzMOXyT~NjrX*J2eIIHP014S`i
zW}s*YRg=V_jO(;eK?sGi{EsYap_Fm)&CMKjojR&HY3;`MDD_wQEZi-Y!quSsRjAA)
z4(P*Xl=|wj7+<PhK=~n5K?Da3f3jm|!NWE@wBmtN6<M4Brpr!TK?s$X#AP8xTSW~`
zml-IEN!^K4v~`|pp)}t`5&REBs5X;$Qfi^8MC!Frd0tbrRSbn@;4l0=>7FY?B62!<
zZbKmfd+}9%KrNgOf><zqD}KE{3u6R)wsY5^5W>a~!nP2?@eqPizmlHE8C&M>L<r%F
h5W@Np!hv&r{0HkmWMP6-2w?yK002ovPDHLkV1i9@85#fp

literal 0
HcmV?d00001

diff --git a/data/64x64/panel-task-switcher.png b/data/64x64/panel-task-switcher.png
new file mode 100644
index 0000000000000000000000000000000000000000..a6b33959e80aca8a371b4deb7c001c11b322f2ff
GIT binary patch
literal 2328
zcmV+z3Fr2SP)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF00004b3#c}2nYxW
zd<bNS000QjNkl<Zc%1FqX^>r25eM+!n|WC#A#91EWLJuaA~P9fQxIIrGLV@`#t<MR
z1Sl;(S#H4{&=UE8Rf;=h`2id<48;~81jMBj3Q8!^3PGfhLS!@SBqYIXGwp}IH*YeT
zK$e;ChVXy&>b`sLyXT(Mr@PNN{qIwmf8M-L;e31u<4`g5h~n6XhT<L3?|NmxwO%}o
zALIJ2D;BOQ3z~o4ybAU~JC4T1T~{o8en%_T*wWg3IgY^|{VFol=*9DRS_)tc))nV3
z73Ymui6^lh@5CXvtEIL1#Rrxyi=y#+%f^4HDErSXt<CFNTAQ`BHpc@?mu*+Y8k?sc
zb-8SO*)v0pzzg^mevVgg6dsa|xDE$kB6@HE{(=u<-{SY<EmNEO)EfVF9A1>&hXbWn
zG`37_uC`2V)-tuZciGYhOAXs9s#5KT6M<K;6#vHGu?mkB=j)`pABko75B`Vcco&+a
zcI>6r_$kG;_u#A8D7EGlJb*vr?z7LGyBw>py0W`(Yn5wkncDna!_)KqQNe1AmW?<D
z6Y#9;z1cWa%?yr3TXBAe6v_#>2uBpxE5)%1<BRepN#UG;k6<ibXqno)dfCzkdk3x9
zymQVf9nX5HPQ!sdsRe6`%8r+QVMTFoZ;UGLzbXYa881sS`4i^J-k$7@J1nGDyo`JC
zQ~VXH7yjnz&CH@&9M|H$;(<4`n_Yl$QVYtuyoNvG<2XqQkQ81yvh??16)Dik_@s2G
zKf>?kopaWT{z51P@S?P>Cx)jz+l|Tip|o+bHy_6LaiN-ezlg`B6W>QoyGE&vXib<Z
z&1XDrl$r;s5kWCbb$9hVH@xlIHq4zrry{j-6S}*4*3F$i=kK^!3gKAk@V+7a#-VcL
zm?j0ckD9L-B}a`f;)S{M=lrp|tLHURZA#RG>c1|!yL#5iQRHIWCFd6Z?e6M%9CyoM
z_H$C*|0VreNFh|EU>4xWx%1~#*<1i40{w*WUEC!7gYK@L4c%QmEAa?^E$1D7mBVZ)
zgwfI*&XXgChE0>tdg}ie<l7J3T|MiBhlJk>YX;ow>+b4#N%({CJ>fxNqYy$xm>_&g
z_`uw==ZvXFU9~*1Ep_U?s;5`c`&+rc=B%^Nyca*gB{)dUF-}G&?jLa`u$@>f=McY_
z!YWN+oSZBjG$Ku4TXFSO*M#t*a7}S6%c}?zg%cY>?Ncv^K|VW*s~29gKExv-9uBd-
zD6bNtDa3JabrUGD8u!aZR*6xVvbzXi1D-05C8{`}D(Xk|H({vj6wxc!IsI3J4VX}^
z!{!gUH;US7w|~(UG*t(G<SmJTa;>0Jtt01O!!W48)-Ymcf<sl_?lKB&6>posZe#)j
z3k~$`E+$Y0VArY%q8H2G(u<)I*Y;e$QFubQzgQHl5ta)#?~-}I>1Uo+Ms2qhRka9j
z1FEN=dD_m_^(Fj3k}(HJqUOe7^#QZboK?ld5R+v@c3TOUiIOWAjl=Lk8QR)eRB@-&
zsi*LKW%e1fdW(~3l7Sg2G|I{^kkQ()+xcusmaMe7?GA>LQ7)e?ndXhfd8vJU{r>kT
zep!`#+E^)orwtuDG!CD@bQz-FQHMM64es~J<?f@!`QgR8Uy?k>M7+Cr|C4y8I6qD<
zhT?XdjIY>ywY0Nnkc8$0!#m+xC&OOflf8bCY}~IU+kBv;#>V4o_=jYRzJu1P3>cQ|
z>}W$rl#W45@#5hWz($2V7w1n&`u(xuT19F@pJb7qmD;iaW2(YqxC(np4Omqay0e%h
z35;oK6x?v22_Kbwfa3RL$v9V}x*sk(_Z-P7d{VZzQVnsC3=tnCrFT94dBe4f`bST;
z8?#RD4C%c3<XU{A;hSw7DARmMv#a2EHLWglAWp{&X_if7&zvv0_<d#Qc#8A~&kRxJ
z*2`>=QtjSsG)N6O3FE55jN(F>EpiMFo;ADkxf`xqwBx2w>+4mx0=L;bDEVfgL2`ue
z$G9r?Q*%-kIV6_M>QMNCJ~<D6;fCuLz3Bp&HM_GS{Zk*g8f+Zoe>?59>v5IImh~FG
zctCx&e~WtUF3aJqV%Qc#Z<|1Uwtr9)7%b#4+<Aj_gKCJia^5~L#cZd9Fp^B5%-}51
zs5TGSnK#uZ1~GwWY(C)`CDTbp?XpU}iD;0ksP+A>jg@)$;|G1>Erx~=_k~y+B8u#Z
zF(Hl&F=fW5+jm$ChBC`zC^4{34Z=Ob%bV($-$}w5!aHVkw(poT9OBUSkYPZb8f4t;
z9<`NPnME~C1{e0&^|jn}Xb7<)#G(+-hv@5<M6`d1FN8S0qqA*Lf6&p{R_W+$8`sg<
zw#A4sVoczcMYpai7?V4MRcaZPRiRn9Nccp@%(jUgGus*ll(vU3U3g!|%(gKD?u{4|
zAk)sTl-bw)6O6~o0LdlzET(kKY}>12W?ShT$Kwnck!{^V2qORuaLY}%ZVd5Yh#wU>
zb-l%?Pzf<Q#1SDDg!om6&xbg%edhFc6=t$uh?7HH7^1a(=JYX)AQLEWEWT;UYr>tv
z&xA*X4Fk+!l5o7RK<E-~7JeZdA?zufBwQ%8w$GS8W~7+Fz;N|Sxuaq=zAWQrO=?NT
zql@p}avMsY8WlBO1{yCYzB{~`aaUq9r?&X!B_XM@CHN-(ARDs5mMLb9a=KjZ)hUH=
zG(Kkdx8n^7wjeADA*^caIQ4GHrFCGIBswR^mE&NWEK4%-Ia^Mz>jp6(3G;Pld2Jo1
zHpq$4{y0%ijGE<YakLcRgyOhSZd17wi>070lY5fCjhod^Sp2=X6$ia8Wp(Q<xAo!G
zwvJO*OV;QXNhuv7g>oRy#lez`yR;~Hr3^i<mBKj;?^7QFXq4nn6>GM8o<F_)lyU>o
zD4A*TOG!arCL6zE$>Q5%diyC8@EN)Bu}N+3PCcM1HTZAaO<FEle0xZzxM6zxDX&V#
yb)j^eD~kKDMw-Hr(vKXVKBCYeDZqR1!~X+0UVWc|%9=$00000<MNUMnLSTY(oQIYG

literal 0
HcmV?d00001

diff --git a/data/64x64/panel-user-desktop.png b/data/64x64/panel-user-desktop.png
new file mode 100644
index 0000000000000000000000000000000000000000..7da52c69dcfdd433cdacfe9565a28e491d6587b6
GIT binary patch
literal 1491
zcmV;^1uXiBP)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF00004b3#c}2nYxW
zd<bNS000GwNkl<Zc%1FqU5K1l83*v+yF1$^Y3!GcRzquPHO9=$ZmSldC`u8m)Ycl4
z-JO};O)H9GL9G_Q5EZ--Ma3&`ypWV7SZQNvEdd3E;+0o5`yn=I>j$AF=||iprD@WA
zy?ExWlVrx7+04#IcK<L8oO$2#p8x-Sp65KzIcE|b#?(C%39iH^@nsC*7x)d1J@BjP
zw3Fi*?Bv6$<gdb~@m0JFS719{#Xm-F8b0yYCl7XPOdS(o^6pB4x1x-%;0E#b2XQ&x
zgA~t<+&FyV;FB{Qv4oBYFnM=n0B^@V_#)m>eRfjwxl~xf5Dt&rIK0>i5msG*D*0>h
zd3+XIF(621NUCj{u??395f)Zkgk<?kR*s21<w0DBdoeCtU|^ZsmT(Ne#n18d^xl1^
zYx*1#)^c_~OIVoRyYEyhV_Y=>Ciawbc&G69Pl@2S9Qh1OcnQD5Px1HZz57m81>J_v
ziQrj_m+?zHHNAJ=>&=cc*X)I@p!$}!<9^&O2HPxo)oZh<awC2;v8OyIg5(z5fw!G?
z&vSSLhtWL&DpRG4(ljmN8~7+L(;E2<17dc#4IA)7%!@H^6mg;!8?7LwwN-%1RA~cl
z!ng2Yyvg~wSvEV|ii`0RAx7I=w`~Gcrb?S|Gro;m#2aeIKoc=Ld`JlTM_kl~e$gfY
zDwCznQnv{5Hw$xYXMjzx3GWx#<K^w@_`C%uPmW)jN<SjZengv1v<8WI^IO{4>52s?
zPmU)dz<mr~M_vqYHFJx$_q`$k$`j*>)Rp)IzJ_;;6n0e;tJOfu0+c4kl2p0{J4HEr
zL$#m2BTtJ0lqSX!TrJYtd!1R-bQ=RA__maDG@Uq<CdLLtA@dng(Os)|$P?-Fi}+h{
zxUe{TaIUE$swn|VmC*q~_zOaSt$K?*5rD53v(Ta9aDH)iW_b~o6=1wFI#})aOQ?t(
zyrU~gO(GG=SC%InDh%h3FDJtPB{E(a%~d<RAG`1tE6eLUg)CvZUgQf;6^8RK&(6#(
zHM*gp0ORG+A?(06aVOrax5;NnL@>NgtU?_s6!R}N5}~dDW98i!V_2lNw+WN#2l5#b
zQ9NB+{Twb7^DoZL%%4*xpCiCndG`jq58n}0SiRMken2L|HNqvHE)?^}=4R$k*Ismn
z0Ar=yoA3dA7atT=ST9BTR*}^YTSY8;wouF;otvG1W7+Ht0Y*!^HVe|<6C!NV-{dnS
zB2B+qr0oCB7k4~AH#`3tB%`HWiKw%06#;KVn9hYjz7{D?;-FYv`V$rg^MxH(;Nv3T
z6<wI*2~LAzdfb7dIFj?fqGr23E^3-Y7845Mg<q0OrT2;D>kFNHhD31PhWm0-DNZ}H
zGE8c|`(2c@=DRj6K8-YoAB*xf+p;2j<tmZ=^<v)N3Q{bHeS<6qSi%wfI+scx#vjB~
zk>N72mp3I6p?=0mJb~}yg_`zLSjau};Qm+eO6?uH#&#|W)jE1uVU>{L1dcrP;Qpg$
z|5$%T=t7{~B<c!~t|0~bvB+sF*1QX>TR^?WwG;!^U7*_o=r-0}pl<8R_-92`!zJiC
z$SSk06<zH-BJ-L!!}EgXMc9b<I`_O!$Iwm}_>VZ(_k<`wn!#2~iv`ObvVfJj!0X~{
z-*b=bf3zt9?%H|hkf_SKhBZG6ta$;tIt}*1blcrbu>1ViU0~e>>b9=Cz}msO3)F30
zcY(EoH7`K@7?7r%yP4Q_RG-rcG<;Aa3rNLwSr2&Wd1Faz^VMCWXe7W%%;9*W8~X$)
z7R9lcSL<ES$OTT~FF1g^#IcgLAD~!87f8kW#Bux?zjxLKaE7`T@c3f~QgMdnXLtbr
t(!zi7dH_p!9uMOO_~+w~9jI%`{{?2&SBZ2p5h(xw002ovPDHLkV1nr8$OZra

literal 0
HcmV?d00001

diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..ed7ebeb
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,18 @@
+icondir = $(datadir)/icons/hicolor
+
+icon16dir = $(icondir)/16x16/apps
+dist_icon16_DATA = $(wildcard $(srcdir)/16x16/*.png)
+
+icon22dir = $(icondir)/22x22/apps
+dist_icon22_DATA = $(wildcard $(srcdir)/22x22/*.png)
+
+icon32dir = $(icondir)/32x32/apps
+dist_icon32_DATA = $(wildcard $(srcdir)/32x32/*.png)
+
+icon48dir = $(icondir)/48x48/apps
+dist_icon48_DATA = $(wildcard $(srcdir)/48x48/*.png)
+
+icon64dir = $(icondir)/64x64/apps
+dist_icon64_DATA = $(wildcard $(srcdir)/64x64/*.png)
+
+-include $(top_srcdir)/git.mk
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 11/25] po: update POTFILES.in
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (9 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 10/25] data: ship our own icons here instead of in sato-icon-theme Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 12/25] build: bump version to 2.9 Jussi Kukkonen
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 po/POTFILES.in | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index b98a590..3ffdd38 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,12 +1,22 @@
-matchbox-panel/mb-panel-scaling-image.c
-matchbox-panel/mb-panel.c
-applets/launcher/launcher.c
-applets/startup/startup.c
+applets/exit/exit.c
 applets/windowselector/windowselector.c
+applets/startup/startup.c
+applets/battery/battery-apm.c
 applets/battery/battery.c
+applets/battery/battery-acpi.c
+applets/launcher/launcher.c
 applets/showdesktop/showdesktop.c
-applets/clock/clock.c
+applets/startup-notify/marshal.c
+applets/startup-notify/startup.c
 applets/systray/systray.c
-applets/systray/na-marshal.c
 applets/systray/na-tray-manager.c
-
+applets/systray/na-tray-child.c
+applets/systray/fixedtip.c
+applets/systray/na-tray.c
+applets/clock/clock.c
+applets/notify/mb-notification.c
+applets/notify/marshal.c
+applets/notify/notify-store.c
+applets/notify/applet.c
+applets/brightness/brightness.c
+applets/common/test_main.c
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 12/25] build: bump version to 2.9
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (10 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 11/25] po: update POTFILES.in Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 13/25] scaling-image: fix whitespace Jussi Kukkonen
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 101df2d..c03c62e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.53)
-AC_INIT(matchbox-panel, 2.0, http://www.openedhand.com/)
+AC_INIT(matchbox-panel, 2.9, http://www.openedhand.com/)
 AM_INIT_AUTOMAKE([-Wno-portability])
 AC_CONFIG_SRCDIR(matchbox-panel/mb-panel.c)
 AM_CONFIG_HEADER(config.h)
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 13/25] scaling-image: fix whitespace
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (11 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 12/25] build: bump version to 2.9 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 14/25] scaling-image: port to GTK+ 3 API Jussi Kukkonen
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 matchbox-panel/mb-panel-scaling-image.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/matchbox-panel/mb-panel-scaling-image.c b/matchbox-panel/mb-panel-scaling-image.c
index 25aa041..dc76b06 100644
--- a/matchbox-panel/mb-panel-scaling-image.c
+++ b/matchbox-panel/mb-panel-scaling-image.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 /*
  * (C) 2006, 2007 OpenedHand Ltd.
  *
@@ -158,7 +159,7 @@ clear_cache (MBPanelScalingImage *image)
 {
         if (!image->priv->caching)
                 return;
-        
+
         g_hash_table_foreach_remove (image->priv->cache,
                                      return_true,
                                      NULL);
@@ -208,18 +209,18 @@ find_icon (GtkIconTheme *icon_theme,
 
         prefixed = g_strconcat ("panel-", stripped, NULL);
 
-        info = gtk_icon_theme_lookup_icon (icon_theme, 
+        info = gtk_icon_theme_lookup_icon (icon_theme,
                                            prefixed,
                                            size,
                                            0);
 
         if (info == NULL) {
-          info = gtk_icon_theme_lookup_icon (icon_theme, 
+          info = gtk_icon_theme_lookup_icon (icon_theme,
                                              stripped,
                                              size,
                                              0);
         }
-        
+
         g_free (stripped);
         g_free (prefixed);
 
@@ -318,7 +319,7 @@ mb_panel_scaling_image_size_allocate (GtkWidget *widget,
 
         widget_class = GTK_WIDGET_CLASS (mb_panel_scaling_image_parent_class);
         widget_class->size_allocate (widget, allocation);
-        
+
         reload_icon (image, FALSE);
 }
 
@@ -328,7 +329,7 @@ mb_panel_scaling_image_realize (GtkWidget *widget)
         GtkWidgetClass *widget_class;
 
         reload_icon (MB_PANEL_SCALING_IMAGE (widget), TRUE);
-        
+
         widget_class = GTK_WIDGET_CLASS (mb_panel_scaling_image_parent_class);
         widget_class->realize (widget);
 }
@@ -382,7 +383,7 @@ mb_panel_scaling_image_screen_changed (GtkWidget *widget,
 
                 reload_icon (MB_PANEL_SCALING_IMAGE (widget), TRUE);
         }
-        
+
         widget_class = GTK_WIDGET_CLASS (mb_panel_scaling_image_parent_class);
         widget_class->screen_changed (widget, old_screen);
 }
@@ -513,7 +514,7 @@ const char *
 mb_panel_scaling_image_get_icon (MBPanelScalingImage *image)
 {
         g_return_val_if_fail (MB_PANEL_IS_SCALING_IMAGE (image), NULL);
-        
+
         return image->priv->icon;
 }
 
@@ -522,7 +523,7 @@ mb_panel_scaling_image_get_icon (MBPanelScalingImage *image)
  * @image: A #MBPanelScalingImage
  * @caching: TRUE if image caching is desired
  *
- * Sets the caching mode to @caching. If @caching is TRUE, 
+ * Sets the caching mode to @caching. If @caching is TRUE,
  * #GdkPixbuf objects previously loaded by @image will be kept around.
  * Use this if you want to quickly alternate between a fixed set of images.
  *
@@ -562,6 +563,6 @@ gboolean
 mb_panel_scaling_image_get_caching (MBPanelScalingImage *image)
 {
         g_return_val_if_fail (MB_PANEL_IS_SCALING_IMAGE (image), FALSE);
-        
+
         return image->priv->caching;
 }
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 14/25] scaling-image: port to GTK+ 3 API
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (12 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 13/25] scaling-image: fix whitespace Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 15/25] mb-panel: allow resizing, but hide the grip Jussi Kukkonen
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 matchbox-panel/mb-panel-scaling-image.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/matchbox-panel/mb-panel-scaling-image.c b/matchbox-panel/mb-panel-scaling-image.c
index dc76b06..56d2d78 100644
--- a/matchbox-panel/mb-panel-scaling-image.c
+++ b/matchbox-panel/mb-panel-scaling-image.c
@@ -240,16 +240,16 @@ find_icon (GtkIconTheme *icon_theme,
 static void
 reload_icon (MBPanelScalingImage *image, gboolean force)
 {
+        GtkAllocation alloc;
         int size;
         char *file;
         GdkPixbuf *pixbuf;
         GError *error;
 
         /* Determine the required icon size */
-        if (image->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-                size = GTK_WIDGET (image)->allocation.height;
-        else
-                size = GTK_WIDGET (image)->allocation.width;
+        gtk_widget_get_allocation (GTK_WIDGET (image), &alloc);
+        size = image->priv->orientation == GTK_ORIENTATION_HORIZONTAL
+                ? alloc.height : alloc.width;
 
         if (!force && size == image->priv->size) {
                 return;
@@ -302,7 +302,9 @@ static void
 icon_theme_changed_cb (GtkIconTheme   *icon_theme,
                        MBPanelScalingImage *image)
 {
-        if (!gtk_widget_get_realized (GTK_WIDGET (image)))
+        GtkWidget *widget = GTK_WIDGET (image);
+
+        if (!gtk_widget_get_realized (widget))
                 return;
 
         clear_cache (image);
@@ -320,7 +322,9 @@ mb_panel_scaling_image_size_allocate (GtkWidget *widget,
         widget_class = GTK_WIDGET_CLASS (mb_panel_scaling_image_parent_class);
         widget_class->size_allocate (widget, allocation);
 
-        reload_icon (image, FALSE);
+        if (gtk_widget_get_realized (widget)) {
+                reload_icon (image, FALSE);
+        }
 }
 
 static void
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 15/25] mb-panel: allow resizing, but hide the grip
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (13 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 14/25] scaling-image: port to GTK+ 3 API Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 16/25] mb-panel: replace --titlebar with --mode Jussi Kukkonen
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 matchbox-panel/mb-panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matchbox-panel/mb-panel.c b/matchbox-panel/mb-panel.c
index 1d6832f..ea1bb19 100644
--- a/matchbox-panel/mb-panel.c
+++ b/matchbox-panel/mb-panel.c
@@ -374,7 +374,7 @@ main (int argc, char **argv)
         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
         gtk_widget_set_name (window, "MatchboxPanel");
         gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DOCK);
-        gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
+        gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE);
 
         /* No key focus please */
         gtk_window_set_accept_focus (GTK_WINDOW (window), FALSE);
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 16/25] mb-panel: replace --titlebar with --mode
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (14 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 15/25] mb-panel: allow resizing, but hide the grip Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 17/25] scaling-image2: revised and slimmer scaling image implementation Jussi Kukkonen
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

--mode supports:

"dock" (usual panel behaviour)
"titlebar" (embed into Matchbox titlebar, not funtional at present)
"window" (normal window, for testing)
---
 matchbox-panel/mb-panel.c | 61 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 46 insertions(+), 15 deletions(-)

diff --git a/matchbox-panel/mb-panel.c b/matchbox-panel/mb-panel.c
index ea1bb19..3f7e3b4 100644
--- a/matchbox-panel/mb-panel.c
+++ b/matchbox-panel/mb-panel.c
@@ -261,7 +261,8 @@ main (int argc, char **argv)
         GOptionGroup *option_group;
         GError *error;
         char *start_applets = NULL, *end_applets = NULL;
-        char *edge_string = NULL;
+        char *edge_string = NULL, *mode_string = NULL;
+        enum { MODE_DOCK, MODE_TITLEBAR, MODE_WINDOW } mode = MODE_DOCK;
         int size = DEFAULT_HEIGHT;
         int screen_num = -1;
         int monitor_num = -1;
@@ -270,7 +271,6 @@ main (int argc, char **argv)
         GdkDisplay *display;
         GdkScreen *screen;
         GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL;
-        gboolean in_titlebar = FALSE;
         GdkRectangle screen_geom;
 
         /* TODO: add these as groups (applets / position) */
@@ -285,13 +285,12 @@ main (int argc, char **argv)
                 { "monitor", 'm', 0, G_OPTION_ARG_INT, &monitor_num,
                   N_("Monitor number"), N_("MONITOR") },
 
-                { "titlebar", 't', 0, G_OPTION_ARG_NONE, &in_titlebar,
-                  N_("Display in window titlebar (with Matchbox theme support)"), NULL },
                 { "edge", 'e', 0, G_OPTION_ARG_STRING, &edge_string,
                   N_("Panel edge"), N_("TOP|BOTTON|LEFT|RIGHT") },
                 { "size", 's', 0, G_OPTION_ARG_INT, &size,
                   N_("Panel size"), N_("PIXELS")},
-
+                { "mode", 'm', 0, G_OPTION_ARG_STRING, &mode_string,
+                  N_("Panel mode"), N_("DOCK|TITLEBAR|WINDOW") },
                 { NULL }
         };
 
@@ -327,12 +326,6 @@ main (int argc, char **argv)
 
         g_option_context_free (option_context);
 
-        /* Can't be in the titlebar *and* on an edge, so check for this and exit */
-        if (in_titlebar && edge_string) {
-                g_printerr ("Cannot specify both --edge and --titlebar\n");
-                return 1;
-        }
-
         if (edge_string) {
                 if (g_ascii_strcasecmp (edge_string, "top") == 0) {
                         edge = GTK_POS_TOP;
@@ -349,6 +342,20 @@ main (int argc, char **argv)
                 g_free (edge_string);
         }
 
+        if (mode_string) {
+                if (g_ascii_strcasecmp (mode_string, "dock") == 0) {
+                        mode = MODE_DOCK;
+                } else if (g_ascii_strcasecmp (mode_string, "titlebar") == 0) {
+                        mode = MODE_TITLEBAR;
+                } else if (g_ascii_strcasecmp (mode_string, "window") == 0) {
+                        mode = MODE_WINDOW;
+                } else {
+                        g_printerr ("Unparsable mode '%s', expecting dock/titlebar/window\n", mode_string);
+                        return 1;
+                }
+                g_free (mode_string);
+        }
+
         /* Set app name */
         g_set_application_name (_("Matchbox Panel"));
 
@@ -373,16 +380,18 @@ main (int argc, char **argv)
         /* Create window */
         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
         gtk_widget_set_name (window, "MatchboxPanel");
-        gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DOCK);
         gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE);
 
-        /* No key focus please */
-        gtk_window_set_accept_focus (GTK_WINDOW (window), FALSE);
+        if (mode != MODE_WINDOW) {
+                gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DOCK);
+                gtk_window_set_accept_focus (GTK_WINDOW (window), FALSE);
+        }
 
         gtk_widget_realize (window);
 
         /* Set size */
-        if (!in_titlebar) {
+        switch (mode) {
+        case MODE_DOCK:
                 /* TODO: hook this up to GdkScreen:size-changed */
 
                 /* Orientation and size */
@@ -420,6 +429,28 @@ main (int argc, char **argv)
                 }
 
                 set_struts (window, edge, size);
+                break;
+        case MODE_TITLEBAR:
+                /* TODO */
+                break;
+        case MODE_WINDOW:
+                /* Set the size based on half the screen dimensions, and
+                   requested size */
+                switch (edge) {
+                case GTK_POS_TOP:
+                case GTK_POS_BOTTOM:
+                        orientation = GTK_ORIENTATION_HORIZONTAL;
+                        gtk_widget_set_size_request (window,
+                                           screen_geom.width / 2, size);
+                        break;
+                case GTK_POS_LEFT:
+                case GTK_POS_RIGHT:
+                        orientation = GTK_ORIENTATION_VERTICAL;
+                        gtk_widget_set_size_request (window,
+                                           size, screen_geom.height / 2);
+                        break;
+                }
+                break;
         }
 
         /* Add frame */
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 17/25] scaling-image2: revised and slimmer scaling image implementation
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (15 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 16/25] mb-panel: replace --titlebar with --mode Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 18/25] applets: add scaling-image2 to the test harness Jussi Kukkonen
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

No caching, but it's lighter and doesn't misbehave (i.e. size-allocate loop).
---
 matchbox-panel/Makefile.am               |   4 +-
 matchbox-panel/mb-panel-scaling-image2.c | 449 +++++++++++++++++++++++++++++++
 matchbox-panel/mb-panel-scaling-image2.h |  64 +++++
 3 files changed, 515 insertions(+), 2 deletions(-)
 create mode 100644 matchbox-panel/mb-panel-scaling-image2.c
 create mode 100644 matchbox-panel/mb-panel-scaling-image2.h

diff --git a/matchbox-panel/Makefile.am b/matchbox-panel/Makefile.am
index 67e0756..a102402 100644
--- a/matchbox-panel/Makefile.am
+++ b/matchbox-panel/Makefile.am
@@ -7,11 +7,11 @@ AM_CFLAGS = $(WARN_CFLAGS)
 
 matchbox_panelincdir = $(pkgincludedir)
 
-matchbox_panelinc_HEADERS = mb-panel.h mb-panel-scaling-image.h
+matchbox_panelinc_HEADERS = mb-panel.h mb-panel-scaling-image.h mb-panel-scaling-image2.h
 
 bin_PROGRAMS = matchbox-panel
 
-matchbox_panel_SOURCES = mb-panel.c mb-panel-scaling-image.c
+matchbox_panel_SOURCES = mb-panel.c mb-panel-scaling-image.c mb-panel-scaling-image2.c
 
 matchbox_panel_LDADD = $(MATCHBOX_PANEL_LIBS)
 
diff --git a/matchbox-panel/mb-panel-scaling-image2.c b/matchbox-panel/mb-panel-scaling-image2.c
new file mode 100644
index 0000000..5692ce1
--- /dev/null
+++ b/matchbox-panel/mb-panel-scaling-image2.c
@@ -0,0 +1,449 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * (C) 2013 Intel Corp
+ *
+ * Author: Ross Burton <ross.burton@intel.com>
+ *
+ * Licensed under the GPL v2 or greater.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gtk/gtk.h>
+
+#include "mb-panel-scaling-image2.h"
+
+struct _MBPanelScalingImage2Private {
+        GtkOrientation orientation;
+        char *icon;
+        int size;
+        GtkIconTheme *icon_theme;
+        guint icon_theme_changed_id;
+        GdkPixbuf *pixbuf;
+};
+
+enum {
+        PROP_0,
+        PROP_ORIENTATION,
+        PROP_ICON,
+};
+
+G_DEFINE_TYPE (MBPanelScalingImage2,
+               mb_panel_scaling_image2,
+               GTK_TYPE_DRAWING_AREA);
+
+static void
+mb_panel_scaling_image2_init (MBPanelScalingImage2 *image)
+{
+        image->priv = G_TYPE_INSTANCE_GET_PRIVATE (image,
+                                                   MB_PANEL_TYPE_SCALING_IMAGE2,
+                                                   MBPanelScalingImage2Private);
+
+        image->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+
+        image->priv->icon = NULL;
+
+        image->priv->pixbuf = NULL;
+}
+
+static void
+mb_panel_scaling_image2_set_property (GObject      *object,
+                                     guint         property_id,
+                                     const GValue *value,
+                                     GParamSpec   *pspec)
+{
+        MBPanelScalingImage2 *image;
+
+        image = MB_PANEL_SCALING_IMAGE2 (object);
+
+        switch (property_id) {
+        case PROP_ORIENTATION:
+                image->priv->orientation = g_value_get_enum (value);
+                break;
+        case PROP_ICON:
+                mb_panel_scaling_image2_set_icon (image,
+                                                 g_value_get_string (value));
+                break;
+        default:
+                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                break;
+        }
+}
+
+static void
+mb_panel_scaling_image2_get_property (GObject    *object,
+                                     guint       property_id,
+                                     GValue     *value,
+                                     GParamSpec *pspec)
+{
+        MBPanelScalingImage2 *image;
+
+        image = MB_PANEL_SCALING_IMAGE2 (object);
+
+        switch (property_id) {
+        case PROP_ORIENTATION:
+                g_value_set_enum (value, image->priv->orientation);
+                break;
+        case PROP_ICON:
+                g_value_set_string (value, image->priv->icon);
+                break;
+        default:
+                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                break;
+        }
+}
+
+static void
+mb_panel_scaling_image2_dispose (GObject *object)
+{
+        MBPanelScalingImage2 *image;
+        GObjectClass *object_class;
+
+        object_class = G_OBJECT_CLASS (mb_panel_scaling_image2_parent_class);
+        image = MB_PANEL_SCALING_IMAGE2 (object);
+
+        if (image->priv->icon_theme_changed_id) {
+                g_signal_handler_disconnect
+                        (image->priv->icon_theme,
+                         image->priv->icon_theme_changed_id);
+                image->priv->icon_theme_changed_id = 0;
+        }
+
+        object_class->dispose (object);
+}
+
+static void
+mb_panel_scaling_image2_finalize (GObject *object)
+{
+        MBPanelScalingImage2 *image;
+        GObjectClass *object_class;
+
+        object_class = G_OBJECT_CLASS (mb_panel_scaling_image2_parent_class);
+        image = MB_PANEL_SCALING_IMAGE2 (object);
+
+        g_free (image->priv->icon);
+
+        object_class->finalize (object);
+}
+
+/* Strips extension off filename */
+static char *
+strip_extension (const char *file)
+{
+        char *stripped, *p;
+
+        stripped = g_strdup (file);
+
+        p = strrchr (stripped, '.');
+        if (p &&
+            (!strcmp (p, ".png") ||
+             !strcmp (p, ".svg") ||
+             !strcmp (p, ".xpm")))
+	        *p = 0;
+
+        return stripped;
+}
+
+/* Find icon filename */
+/* This follows the same logic as gnome-panel. This should hopefully
+ * ensure correct behaviour. */
+static char *
+find_icon (GtkIconTheme *icon_theme,
+           const char   *icon,
+           int           size)
+{
+        GtkIconInfo *info;
+        char *new_icon, *stripped, *prefixed;
+
+        if (g_path_is_absolute (icon)) {
+                if (g_file_test (icon, G_FILE_TEST_EXISTS))
+                        return g_strdup (icon);
+                else
+                        new_icon = g_path_get_basename (icon);
+        } else
+                new_icon = (char *) icon;
+
+        stripped = strip_extension (new_icon);
+
+        if (new_icon != icon)
+                g_free (new_icon);
+
+        prefixed = g_strconcat ("panel-", stripped, NULL);
+
+        info = gtk_icon_theme_lookup_icon (icon_theme,
+                                           prefixed,
+                                           size,
+                                           0);
+
+        if (info == NULL) {
+          info = gtk_icon_theme_lookup_icon (icon_theme,
+                                             stripped,
+                                             size,
+                                             0);
+        }
+
+        g_free (stripped);
+        g_free (prefixed);
+
+        if (info) {
+                char *file;
+
+                file = g_strdup (gtk_icon_info_get_filename (info));
+
+                gtk_icon_info_free (info);
+
+                return file;
+        } else
+                return NULL;
+}
+
+/* Reload the specified icon */
+static void
+reload_icon (MBPanelScalingImage2 *image, gboolean force)
+{
+        GtkAllocation alloc;
+        int size;
+        char *file;
+        GError *error;
+        GdkPixbuf *pixbuf;
+
+        /* Determine the required icon size */
+        gtk_widget_get_allocation (GTK_WIDGET (image), &alloc);
+        size = image->priv->orientation == GTK_ORIENTATION_HORIZONTAL
+                ? alloc.height : alloc.width;
+
+        if (!force && size == image->priv->size) {
+                return;
+        }
+
+        image->priv->size = size;
+
+        if (!image->priv->icon) {
+                g_clear_object (&image->priv->pixbuf);
+                gtk_image_set_from_pixbuf (GTK_IMAGE (image), NULL);
+                gtk_widget_queue_resize (GTK_WIDGET (image));
+                return;
+        }
+
+        file = find_icon (image->priv->icon_theme,
+                          image->priv->icon,
+                          size);
+	if (!file) {
+                g_warning ("Icon \"%s\" not found", image->priv->icon);
+
+                return;
+        }
+
+        error = NULL;
+        pixbuf = gdk_pixbuf_new_from_file_at_scale (file, size, size, TRUE, &error);
+        g_free (file);
+
+        g_clear_object (&image->priv->pixbuf);
+        if (pixbuf) {
+                image->priv->pixbuf = pixbuf;
+        } else {
+                g_warning ("No pixbuf found: %s", error->message);
+                g_error_free (error);
+        }
+
+        gtk_widget_queue_resize (GTK_WIDGET (image));
+}
+
+/* Icon theme changed */
+static void
+icon_theme_changed_cb (GtkIconTheme   *icon_theme,
+                       MBPanelScalingImage2 *image)
+{
+        GtkWidget *widget = GTK_WIDGET (image);
+
+        if (gtk_widget_get_realized (widget)) {
+                reload_icon (image, TRUE);
+        }
+}
+
+static void
+mb_panel_scaling_image2_size_allocate (GtkWidget *widget,
+                                      GtkAllocation *allocation)
+{
+        MBPanelScalingImage2 *image = MB_PANEL_SCALING_IMAGE2 (widget);
+        GtkWidgetClass *widget_class;
+
+        widget_class = GTK_WIDGET_CLASS (mb_panel_scaling_image2_parent_class);
+        widget_class->size_allocate (widget, allocation);
+
+        if (gtk_widget_get_realized (widget)) {
+                reload_icon (image, FALSE);
+        }
+}
+
+static void
+mb_panel_scaling_image2_realize (GtkWidget *widget)
+{
+        GtkWidgetClass *widget_class;
+
+        reload_icon (MB_PANEL_SCALING_IMAGE2 (widget), TRUE);
+
+        widget_class = GTK_WIDGET_CLASS (mb_panel_scaling_image2_parent_class);
+        widget_class->realize (widget);
+}
+
+static void
+mb_panel_scaling_image2_screen_changed (GtkWidget *widget,
+                                        GdkScreen *old_screen)
+{
+        MBPanelScalingImage2 *image;
+        GdkScreen *screen;
+        GtkIconTheme *new_icon_theme;
+
+        if (GTK_WIDGET_CLASS (mb_panel_scaling_image2_parent_class)->screen_changed)
+                GTK_WIDGET_CLASS (mb_panel_scaling_image2_parent_class)->screen_changed (widget, old_screen);
+
+        image = MB_PANEL_SCALING_IMAGE2 (widget);
+        screen = gtk_widget_get_screen (widget);
+        new_icon_theme = gtk_icon_theme_get_for_screen (screen);
+        if (image->priv->icon_theme == new_icon_theme)
+                return;
+
+        if (image->priv->icon_theme_changed_id) {
+                g_signal_handler_disconnect
+                        (image->priv->icon_theme,
+                         image->priv->icon_theme_changed_id);
+        }
+
+        image->priv->icon_theme = new_icon_theme;
+
+        image->priv->icon_theme_changed_id =
+                g_signal_connect (image->priv->icon_theme,
+                                  "changed",
+                                  G_CALLBACK (icon_theme_changed_cb),
+                                  image);
+
+        if (gtk_widget_get_realized (widget)) {
+                reload_icon (MB_PANEL_SCALING_IMAGE2 (widget), TRUE);
+        }
+}
+static gboolean
+mb_panel_scaling_image2_draw (GtkWidget *widget, cairo_t *cr)
+{
+        MBPanelScalingImage2 *image = MB_PANEL_SCALING_IMAGE2 (widget);
+
+        gdk_cairo_set_source_pixbuf (cr, image->priv->pixbuf, 0.0, 0.0);
+        cairo_paint (cr);
+        return TRUE;
+}
+
+static void
+mb_panel_scaling_image2_get_preferred_width (GtkWidget *widget, int *minimum_width, int *natural_width)
+{
+        MBPanelScalingImage2 *image = MB_PANEL_SCALING_IMAGE2 (widget);
+
+        if (image->priv->pixbuf) {
+                *minimum_width = *natural_width = gdk_pixbuf_get_width (image->priv->pixbuf);
+        } else {
+                *minimum_width = *natural_width = 1;
+        }
+}
+
+static void
+mb_panel_scaling_image2_class_init (MBPanelScalingImage2Class *klass)
+{
+        GObjectClass *object_class;
+        GtkWidgetClass *widget_class;
+
+        object_class = G_OBJECT_CLASS (klass);
+
+        object_class->set_property = mb_panel_scaling_image2_set_property;
+        object_class->get_property = mb_panel_scaling_image2_get_property;
+        object_class->dispose      = mb_panel_scaling_image2_dispose;
+        object_class->finalize     = mb_panel_scaling_image2_finalize;
+
+        widget_class = GTK_WIDGET_CLASS (klass);
+        widget_class->size_allocate  = mb_panel_scaling_image2_size_allocate;
+        widget_class->realize        = mb_panel_scaling_image2_realize;
+        widget_class->screen_changed = mb_panel_scaling_image2_screen_changed;
+        /* TODO: respect orientation and switch to height-for-width in vertical mode */
+        widget_class->get_preferred_width = mb_panel_scaling_image2_get_preferred_width;
+        widget_class->draw = mb_panel_scaling_image2_draw;
+
+        g_type_class_add_private (klass, sizeof (MBPanelScalingImage2Private));
+
+        g_object_class_install_property
+                (object_class,
+                 PROP_ORIENTATION,
+                 g_param_spec_enum
+                         ("orientation",
+                          "orientation",
+                          "The containing panels orientation.",
+                          GTK_TYPE_ORIENTATION,
+                          GTK_ORIENTATION_HORIZONTAL,
+                          G_PARAM_READWRITE |
+                          G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
+                          G_PARAM_STATIC_BLURB));
+
+        g_object_class_install_property
+                (object_class,
+                 PROP_ICON,
+                 g_param_spec_string
+                         ("icon",
+                          "icon",
+                          "The loaded icon.",
+                          NULL,
+                          G_PARAM_READWRITE |
+                          G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
+                          G_PARAM_STATIC_BLURB));
+}
+
+/**
+ * mb_panel_scaling_image2_new
+ * @orientation: The orientation of the containing panel.
+ * @icon: The icon to display. This can be an absolute path, or a name
+ * of an icon theme icon.
+ *
+ * Return value: A new #MBPanelScalingImage2 object displaying @icon.
+ **/
+GtkWidget *
+mb_panel_scaling_image2_new (GtkOrientation orientation,
+                            const char    *icon)
+{
+        return g_object_new (MB_PANEL_TYPE_SCALING_IMAGE2,
+                             "orientation", orientation,
+                             "icon", icon,
+                             NULL);
+}
+
+/**
+ * mb_panel_scaling_image2_set_icon
+ * @image: A #MBPanelScalingImage2
+ * @icon: The icon to display. This can be an absolute path, or a name
+ * of an icon theme icon.
+ *
+ * Displays @icon in @image.
+ **/
+void
+mb_panel_scaling_image2_set_icon (MBPanelScalingImage2 *image,
+                                 const char          *icon)
+{
+        g_return_if_fail (MB_PANEL_IS_SCALING_IMAGE2 (image));
+
+        g_free (image->priv->icon);
+        image->priv->icon = g_strdup (icon);
+
+        if (!gtk_widget_get_realized (GTK_WIDGET (image)))
+                return;
+
+        reload_icon (image, TRUE);
+}
+
+/**
+ * mb_panel_scaling_image2_get_icon
+ * @image: A #MBPanelScalingImage2
+ *
+ * Return value: The displayed icon. This string should not be freed.
+ **/
+const char *
+mb_panel_scaling_image2_get_icon (MBPanelScalingImage2 *image)
+{
+        g_return_val_if_fail (MB_PANEL_IS_SCALING_IMAGE2 (image), NULL);
+
+        return image->priv->icon;
+}
diff --git a/matchbox-panel/mb-panel-scaling-image2.h b/matchbox-panel/mb-panel-scaling-image2.h
new file mode 100644
index 0000000..5c0dd76
--- /dev/null
+++ b/matchbox-panel/mb-panel-scaling-image2.h
@@ -0,0 +1,64 @@
+/*
+ * (C) 2013 Intel Corp
+ *
+ * Author: Ross Burton <ross.burton@intel.com>
+ *
+ * Licensed under the GPL v2 or greater.
+ */
+
+#ifndef __MB_PANEL_SCALING_IMAGE2_H__
+#define __MB_PANEL_SCALING_IMAGE2_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define MB_PANEL_TYPE_SCALING_IMAGE2 \
+                (mb_panel_scaling_image2_get_type ())
+#define MB_PANEL_SCALING_IMAGE2(obj) \
+                (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                 MB_PANEL_TYPE_SCALING_IMAGE2, \
+                 MBPanelScalingImage2))
+#define MB_PANEL_SCALING_IMAGE2_CLASS(klass) \
+                (G_TYPE_CHECK_CLASS_CAST ((klass), \
+                 MB_PANEL_TYPE_SCALING_IMAGE2, \
+                 MBPanelScalingImage2Class))
+#define MB_PANEL_IS_SCALING_IMAGE2(obj) \
+                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                 MB_PANEL_TYPE_SCALING_IMAGE2))
+#define MB_PANEL_IS_SCALING_IMAGE2_CLASS(klass) \
+                (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                 MB_PANEL_TYPE_SCALING_IMAGE2))
+#define MB_PANEL_SCALING_IMAGE2_GET_CLASS(obj) \
+                (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                 MB_PANEL_TYPE_SCALING_IMAGE2, \
+                 MBPanelScalingImage2Class))
+
+typedef struct _MBPanelScalingImage2Private MBPanelScalingImage2Private;
+
+typedef struct {
+        GtkDrawingArea parent;
+        MBPanelScalingImage2Private *priv;
+} MBPanelScalingImage2;
+
+typedef struct {
+        GtkDrawingAreaClass parent_class;
+} MBPanelScalingImage2Class;
+
+GType
+mb_panel_scaling_image2_get_type (void) G_GNUC_CONST;
+
+GtkWidget *
+mb_panel_scaling_image2_new         (GtkOrientation       orientation,
+                                    const char          *icon);
+
+void
+mb_panel_scaling_image2_set_icon    (MBPanelScalingImage2 *image,
+                                    const char          *icon);
+
+const char *
+mb_panel_scaling_image2_get_icon    (MBPanelScalingImage2 *image);
+
+G_END_DECLS
+
+#endif /* __MB_PANEL_SCALING_IMAGE_H__ */
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 18/25] applets: add scaling-image2 to the test harness
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (16 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 17/25] scaling-image2: revised and slimmer scaling image implementation Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 19/25] showdesktop: port to use scaling-image2 Jussi Kukkonen
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/Makefile.applets | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/applets/Makefile.applets b/applets/Makefile.applets
index 9538818..1fff4ff 100644
--- a/applets/Makefile.applets
+++ b/applets/Makefile.applets
@@ -9,5 +9,6 @@ appletdir = $(pkglibdir)
 # Binary to check that the applet actually links against everything it needs.
 noinst_PROGRAMS = test-linkage
 test_linkage_SOURCES = $(srcdir)/../common/test_main.c \
-                       $(top_srcdir)/matchbox-panel/mb-panel-scaling-image.c
+                       $(top_srcdir)/matchbox-panel/mb-panel-scaling-image.c \
+                       $(top_srcdir)/matchbox-panel/mb-panel-scaling-image2.c
 test_linkage_LDADD = $(MATCHBOX_PANEL_LIBS)
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 19/25] showdesktop: port to use scaling-image2
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (17 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 18/25] applets: add scaling-image2 to the test harness Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 20/25] Fix a crash on startup Jussi Kukkonen
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

From: Ross Burton <ross.burton@intel.com>

---
 applets/showdesktop/showdesktop.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/applets/showdesktop/showdesktop.c b/applets/showdesktop/showdesktop.c
index e40ebc3..14f9d96 100644
--- a/applets/showdesktop/showdesktop.c
+++ b/applets/showdesktop/showdesktop.c
@@ -11,11 +11,11 @@
 #include <gdk/gdkx.h>
 #include <X11/Xatom.h>
 #include <matchbox-panel/mb-panel.h>
-#include <matchbox-panel/mb-panel-scaling-image.h>
+#include <matchbox-panel/mb-panel-scaling-image2.h>
 
 typedef struct {
         GtkButton *button;
-        MBPanelScalingImage *image;
+        MBPanelScalingImage2 *image;
 
         gboolean active;
 
@@ -45,15 +45,11 @@ show_desktop_applet_free (ShowDesktopApplet *applet)
 static void
 set_active (ShowDesktopApplet *applet, gboolean active)
 {
-        const char *icon;
-
         applet->active = active;
 
         /* TODO: remove this function and instead use a toggle button? */
 
-        icon = "panel-user-desktop";
-
-        mb_panel_scaling_image_set_icon (applet->image, icon);
+        mb_panel_scaling_image2_set_icon (applet->image, "panel-user-desktop");
 }
 
 /* Sync @applet with the _NET_SHOWING_DESKTOP root window property */
@@ -206,8 +202,8 @@ mb_panel_applet_create (const char    *id,
 
         gtk_widget_set_name (button, "MatchboxPanelShowDesktop");
 
-        image = mb_panel_scaling_image_new (orientation, NULL);
-        applet->image = MB_PANEL_SCALING_IMAGE (image);
+        image = mb_panel_scaling_image2_new (orientation, NULL);
+        applet->image = MB_PANEL_SCALING_IMAGE2 (image);
 
         gtk_container_add (GTK_CONTAINER (button), image);
 
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 20/25] Fix a crash on startup
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (18 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 19/25] showdesktop: port to use scaling-image2 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 21/25] Don't use deprecated GtkMisc Jussi Kukkonen
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

---
 matchbox-panel/mb-panel-scaling-image2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/matchbox-panel/mb-panel-scaling-image2.c b/matchbox-panel/mb-panel-scaling-image2.c
index 5692ce1..8cdc3a1 100644
--- a/matchbox-panel/mb-panel-scaling-image2.c
+++ b/matchbox-panel/mb-panel-scaling-image2.c
@@ -327,8 +327,10 @@ mb_panel_scaling_image2_draw (GtkWidget *widget, cairo_t *cr)
 {
         MBPanelScalingImage2 *image = MB_PANEL_SCALING_IMAGE2 (widget);
 
-        gdk_cairo_set_source_pixbuf (cr, image->priv->pixbuf, 0.0, 0.0);
-        cairo_paint (cr);
+        if (image->priv->pixbuf) {
+                gdk_cairo_set_source_pixbuf (cr, image->priv->pixbuf, 0.0, 0.0);
+                cairo_paint (cr);
+        }
         return TRUE;
 }
 
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 21/25] Don't use deprecated GtkMisc
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (19 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 20/25] Fix a crash on startup Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 22/25] Update .pc-file to require Gtk+-3.0 Jussi Kukkonen
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

These changes should not affect fucntionality

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
 applets/notify/mb-notification.c | 2 +-
 applets/systray/fixedtip.c       | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/applets/notify/mb-notification.c b/applets/notify/mb-notification.c
index e440ec9..c73b21f 100644
--- a/applets/notify/mb-notification.c
+++ b/applets/notify/mb-notification.c
@@ -85,7 +85,7 @@ mb_notification_init (MbNotification *self)
   gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0);
 
   priv->label = gtk_label_new (NULL);
-  gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
+  gtk_label_set_xalign (GTK_LABEL (priv->label), 0.0);
   gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0);
 }
 
diff --git a/applets/systray/fixedtip.c b/applets/systray/fixedtip.c
index 861e4ab..ce19067 100644
--- a/applets/systray/fixedtip.c
+++ b/applets/systray/fixedtip.c
@@ -116,7 +116,6 @@ na_fixed_tip_init (NaFixedTip *fixedtip)
 
   label = gtk_label_new (NULL);
   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
   gtk_widget_show (label);
   gtk_container_add (GTK_CONTAINER (fixedtip), label);
   fixedtip->priv->label = label;
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 22/25] Update .pc-file to require Gtk+-3.0
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (20 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 21/25] Don't use deprecated GtkMisc Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 23/25] Draw systray icons in their actual locations Jussi Kukkonen
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

---
 matchbox-panel.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matchbox-panel.pc.in b/matchbox-panel.pc.in
index dc0a75c..90374b7 100644
--- a/matchbox-panel.pc.in
+++ b/matchbox-panel.pc.in
@@ -8,4 +8,4 @@ Name: matchbox-panel
 Description: Simple GTK+ based panel
 Version: @VERSION@
 Cflags: -I${includedir}
-Requires: glib-2.0 gtk+-2.0
+Requires: glib-2.0 gtk+-3.0
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 23/25] Draw systray icons in their actual locations
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (21 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 22/25] Update .pc-file to require Gtk+-3.0 Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 24/25] mb-panel: size request needs to be set before realize Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 25/25] windowselector: Port to ScalingImage2 Jussi Kukkonen
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

Cairo context is now in widget-relative coordinates instead of
window-relative: undo that transform so the icon draw code actually
draws inside the window.

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
 applets/systray/na-tray.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/applets/systray/na-tray.c b/applets/systray/na-tray.c
index 7da908f..714bd90 100644
--- a/applets/systray/na-tray.c
+++ b/applets/systray/na-tray.c
@@ -538,6 +538,8 @@ static void
 na_tray_draw_box (GtkWidget *box,
 		  cairo_t   *cr)
 {
+  /* Transform to window-relative coordinates */
+  gtk_cairo_transform_to_window (cr, box, gtk_widget_get_window (box));
   gtk_container_foreach (GTK_CONTAINER (box), na_tray_draw_icon, cr);
 }
 
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 24/25] mb-panel: size request needs to be set before realize
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (22 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 23/25] Draw systray icons in their actual locations Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 25/25] windowselector: Port to ScalingImage2 Jussi Kukkonen
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

GtkWindow will default to 200 height on realize unless we request
otherwise  before that. On the other hand, struts can only be set
after the window has been realized.

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
 matchbox-panel/mb-panel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/matchbox-panel/mb-panel.c b/matchbox-panel/mb-panel.c
index 3f7e3b4..4f5fb74 100644
--- a/matchbox-panel/mb-panel.c
+++ b/matchbox-panel/mb-panel.c
@@ -387,8 +387,6 @@ main (int argc, char **argv)
                 gtk_window_set_accept_focus (GTK_WINDOW (window), FALSE);
         }
 
-        gtk_widget_realize (window);
-
         /* Set size */
         switch (mode) {
         case MODE_DOCK:
@@ -427,8 +425,6 @@ main (int argc, char **argv)
                                          screen_geom.x,
                                          screen_geom.y + screen_geom.height - size);
                 }
-
-                set_struts (window, edge, size);
                 break;
         case MODE_TITLEBAR:
                 /* TODO */
@@ -453,6 +449,10 @@ main (int argc, char **argv)
                 break;
         }
 
+        gtk_widget_realize (window);
+        if (mode == MODE_DOCK)
+		set_struts (window, edge, size);
+
         /* Add frame */
         frame = gtk_frame_new (NULL);
         gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [matchbox-panel-2][PATCH 25/25] windowselector: Port to ScalingImage2
  2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
                   ` (23 preceding siblings ...)
  2016-05-03 11:30 ` [matchbox-panel-2][PATCH 24/25] mb-panel: size request needs to be set before realize Jussi Kukkonen
@ 2016-05-03 11:30 ` Jussi Kukkonen
  24 siblings, 0 replies; 26+ messages in thread
From: Jussi Kukkonen @ 2016-05-03 11:30 UTC (permalink / raw)
  To: yocto

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
 applets/windowselector/windowselector.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/applets/windowselector/windowselector.c b/applets/windowselector/windowselector.c
index 9c1dadf..d269355 100644
--- a/applets/windowselector/windowselector.c
+++ b/applets/windowselector/windowselector.c
@@ -15,7 +15,7 @@
 #include <gdk/gdkx.h>
 
 #include <matchbox-panel/mb-panel.h>
-#include <matchbox-panel/mb-panel-scaling-image.h>
+#include <matchbox-panel/mb-panel-scaling-image2.h>
 
 #define DEFAULT_WINDOW_ICON_NAME "application-x-executable"
 
@@ -792,7 +792,7 @@ mb_panel_applet_create (const char    *id,
 
         switch (applet->mode) {
         case MODE_STATIC_ICON:
-                applet->image = mb_panel_scaling_image_new (orientation,
+                applet->image = mb_panel_scaling_image2_new (orientation,
                         "panel-task-switcher");
                 gtk_container_add (GTK_CONTAINER (applet->button),
                                 applet->image);
-- 
2.8.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2016-05-03 11:32 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03 11:30 [matchbox-panel-2][PATCH 00/25] Upgrade to Gtk+3 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 01/25] build: check for GTK+3, and require 3.0 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 02/25] windowselector: port to GTK+ 3 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 03/25] startup: " Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 04/25] startup-notify: " Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 05/25] showdesktop: " Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 06/25] launcher: " Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 07/25] mb-panel: port to GTK+3 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 08/25] notify: port to GTK+ 3 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 09/25] systray: " Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 10/25] data: ship our own icons here instead of in sato-icon-theme Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 11/25] po: update POTFILES.in Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 12/25] build: bump version to 2.9 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 13/25] scaling-image: fix whitespace Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 14/25] scaling-image: port to GTK+ 3 API Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 15/25] mb-panel: allow resizing, but hide the grip Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 16/25] mb-panel: replace --titlebar with --mode Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 17/25] scaling-image2: revised and slimmer scaling image implementation Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 18/25] applets: add scaling-image2 to the test harness Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 19/25] showdesktop: port to use scaling-image2 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 20/25] Fix a crash on startup Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 21/25] Don't use deprecated GtkMisc Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 22/25] Update .pc-file to require Gtk+-3.0 Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 23/25] Draw systray icons in their actual locations Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 24/25] mb-panel: size request needs to be set before realize Jussi Kukkonen
2016-05-03 11:30 ` [matchbox-panel-2][PATCH 25/25] windowselector: Port to ScalingImage2 Jussi Kukkonen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.