r338 ./hildon-desktop/ubuntu: Add multiple screen resolution and rotation support

Horace Li horace.li at intel.com
Tue Feb 26 05:48:02 UTC 2008


------------------------------------------------------------
revno: 338
committer: Horace Li <horace.li at intel.com>
branch nick: hildon-desktop
timestamp: Tue 2008-02-26 13:48:02 +0800
message:
  Add multiple screen resolution and rotation support
added:
  debian/patches/21_multiple_resolution_support.patch
  debian/patches/22_fast_reboot.patch
-------------- next part --------------
=== added file 'debian/patches/21_multiple_resolution_support.patch'
--- a/debian/patches/21_multiple_resolution_support.patch	1970-01-01 00:00:00 +0000
+++ b/debian/patches/21_multiple_resolution_support.patch	2008-02-26 05:48:02 +0000
@@ -0,0 +1,409 @@
+diff -Nur hildon-desktop/libhildondesktop/hildon-desktop-home-item.c hildon-desktop-new/libhildondesktop/hildon-desktop-home-item.c
+--- hildon-desktop/libhildondesktop/hildon-desktop-home-item.c	2008-02-22 16:57:45.000000000 +0800
++++ hildon-desktop-new/libhildondesktop/hildon-desktop-home-item.c	2008-02-22 19:22:40.000000000 +0800
+@@ -69,7 +69,7 @@
+ #define APPLET_CLOSE_BUTTON_HEIGHT  26
+ 
+ #define GRID_SIZE                       10
+-#define CLICK_TIMEOUT                   400
++#define CLICK_TIMEOUT                   0
+ #define MOVING_THRESHOLD                30
+ 
+ #define HILDON_DESKTOP_HOME_ITEM_GET_PRIVATE(obj) \
+@@ -206,6 +206,8 @@
+ hildon_desktop_home_item_propagate_motion_notify (HildonDesktopHomeItem *item,
+                                                   GdkEventMotion        *event);
+ 
++static void 
++hildon_desktop_home_item_screen_changed (GdkScreen *screen, HildonDesktopHomeItem *item);
+ 
+ /**
+  * hildon_desktop_home_item_resize_type_get_type:
+@@ -465,6 +467,12 @@
+ {
+   HildonDesktopHomeItemPriv    *priv;
+   HildonDesktopHomeItemClass   *klass;
++  GdkScreen *screen;
++
++  screen = gtk_widget_get_screen (GTK_WIDGET(self));
++
++  g_signal_connect (G_OBJECT(screen), "size-changed", 
++                    G_CALLBACK(hildon_desktop_home_item_screen_changed), self);
+ 
+   klass = G_TYPE_INSTANCE_GET_CLASS ((self),
+                                      HILDON_DESKTOP_TYPE_HOME_ITEM,
+@@ -1843,3 +1851,10 @@
+   gtk_widget_queue_draw (GTK_WIDGET (item));
+ 
+ }
++
++static void
++hildon_desktop_home_item_screen_changed (GdkScreen *screen, HildonDesktopHomeItem *item)
++{
++  return HILDON_DESKTOP_HOME_ITEM_GET_CLASS (item)->screen_changed (item);
++}
++
+diff -Nur hildon-desktop/libhildondesktop/hildon-desktop-home-item.h hildon-desktop-new/libhildondesktop/hildon-desktop-home-item.h
+--- hildon-desktop/libhildondesktop/hildon-desktop-home-item.h	2008-02-22 16:56:54.000000000 +0800
++++ hildon-desktop-new/libhildondesktop/hildon-desktop-home-item.h	2008-02-22 19:25:09.000000000 +0800
+@@ -45,6 +45,8 @@
+ #define HILDON_DESKTOP_TYPE_HOME_ITEM_RESIZE_TYPE \
+                                         (hildon_desktop_home_item_resize_type_get_type())
+ 
++#define HILDON_DESKTOP_HOME_ITEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), HILDON_DESKTOP_TYPE_HOME_ITEM, HildonDesktopHomeItemClass))
++
+ /**
+  * HildonDesktopHomeItemResizeType:
+  * @HILDON_DESKTOP_HOME_ITEM_RESIZE_NONE: cannot be resized.
+@@ -79,6 +81,7 @@
+   void (* foreground)           (HildonDesktopHomeItem *applet);
+   GtkWidget * (*settings)       (HildonDesktopHomeItem *applet,
+                                  GtkWidget        *parent);
++  void (* screen_changed)       (HildonDesktopHomeItem *applet);
+ 
+   GdkPixbuf                     *close_button;
+   GdkPixbuf                     *resize_handle;
+diff -Nur hildon-desktop/libhildondesktop/hildon-desktop-panel.c hildon-desktop-new/libhildondesktop/hildon-desktop-panel.c
+--- hildon-desktop/libhildondesktop/hildon-desktop-panel.c	2008-02-22 16:58:20.000000000 +0800
++++ hildon-desktop-new/libhildondesktop/hildon-desktop-panel.c	2008-02-22 19:17:35.000000000 +0800
+@@ -328,12 +328,7 @@
+ hildon_desktop_panel_calc_positions (HildonDesktopPanel *panel,
+                                      HildonDesktopPanelItem *item)
+ {
+-  /* FIXME: Please, implement me smoothly and very optimized */
+-  /* FIXME: This is not that smooth implementation, this only add the item*/
+-  if (panel->pack_start)
+-    gtk_box_pack_start (GTK_BOX (panel), GTK_WIDGET (item), FALSE, FALSE,0);
+-  else
+-    gtk_box_pack_end   (GTK_BOX (panel), GTK_WIDGET (item), FALSE, FALSE, 0);
++  gtk_box_pack_start (GTK_BOX (panel), GTK_WIDGET (item), FALSE, FALSE,0);
+ 
+   gtk_widget_show    (GTK_WIDGET (item));
+ }
+@@ -381,12 +376,7 @@
+     hildon_desktop_panel_calc_positions (panel, HILDON_DESKTOP_PANEL_ITEM (widget));/*FIXME: Do this! */
+   }
+   else
+-  {
+-    if (panel->pack_start)
+-      gtk_box_pack_start (GTK_BOX (panel), widget, FALSE, FALSE, 0);
+-    else
+-      gtk_box_pack_end   (GTK_BOX (panel), widget, FALSE, FALSE, 0);
+-  }
++    gtk_box_pack_start (GTK_BOX (panel), widget, FALSE, FALSE, 0);
+ }
+ 
+ void 
+diff -Nur hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c hildon-desktop-new/libhildondesktop/hildon-desktop-panel-expandable.c
+--- hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2008-02-22 16:57:51.000000000 +0800
++++ hildon-desktop-new/libhildondesktop/hildon-desktop-panel-expandable.c	2008-02-22 19:56:19.000000000 +0800
+@@ -88,6 +88,7 @@
+   GtkTable   *extension_table;
+ 
+   gboolean    extension_opened;
++  gboolean    extension_used;
+ 
+   GtkWidget  *arrow;
+ #ifdef SYSTRAY_SUPPORT
+@@ -143,8 +144,6 @@
+ 
+ static void hildon_desktop_panel_expandable_resize_notify (HildonDesktopPanelExpandable *panel);
+ 
+-static void hildon_desktop_panel_expandable_requeue_last_in_panel (HildonDesktopPanelExpandable *panel);
+-
+ static void hildon_desktop_panel_expandable_hash_adding (gchar *key, HildonDesktopItem *item, GList **list);
+ #ifdef SYSTRAY_SUPPORT
+ static void hildon_desktop_panel_expandable_init_systray (HildonDesktopPanelExpandable *panel, gpointer data);
+@@ -231,6 +230,7 @@
+ 
+   panel->priv->queued_items = NULL;
+   panel->priv->extension_opened = FALSE;
++  panel->priv->extension_used = FALSE;
+   panel->priv->extension_table = NULL;
+ #ifdef SYSTRAY_SUPPORT
+   panel->priv->filter_added = FALSE;
+@@ -422,7 +422,7 @@
+   if (item_width == 0 || item_height == 0)
+     g_object_set (object, "item_width", HSB_ITEM_WIDTH, "item_height", HSB_ITEM_HEIGHT, NULL);
+ 
+-  HILDON_DESKTOP_PANEL (panel)->pack_start = FALSE;
++  HILDON_DESKTOP_PANEL (panel)->pack_start = TRUE;
+ 
+ #ifdef SYSTRAY_SUPPORT
+   g_signal_connect_after (panel,
+@@ -652,32 +652,24 @@
+     }  
+     ex_panel->priv->n_items++;
+   }
+-  else 
+-  if ((ex_panel->priv->n_items+2) > ex_panel->priv->items_p_row && (ex_panel->priv->n_items+1) != ex_panel->priv->items_p_row)
++  else if ((ex_panel->priv->n_items+2) > ex_panel->priv->items_p_row && TRUE == ex_panel->priv->extension_used )
+   { 
+     if (STATUSBAR_IS_ITEM (button) && !STATUSBAR_ITEM (button)->condition)
+       sb_debug ("Statusbar: Item not visible %s",HILDON_DESKTOP_ITEM (button)->id);
+-    else  
+-    {	    
+-      if ((ex_panel->priv->n_items) == ex_panel->priv->items_p_row)
+-      {	     
+-        hildon_desktop_panel_expandable_requeue_last_in_panel (ex_panel);
+-
+-	if (ex_panel->priv->arrow == NULL)
++    else
++    {
++      if ((ex_panel->priv->n_items+1) == ex_panel->priv->items_p_row)
++      {
++        if (ex_panel->priv->arrow == NULL)
+         {
+           GtkWidget *arrow = hildon_desktop_panel_expandable_add_arrow (ex_panel);
+-      
+-          HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,arrow);
+-      
+           ex_panel->priv->arrow = arrow;
+         }
+-	
+-	hildon_desktop_panel_expandable_add_in_extension (ex_panel, item);
+-      }	
+-      else
+-      {	      
+-        hildon_desktop_panel_expandable_add_in_extension (ex_panel, item);
++
++        HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,ex_panel->priv->arrow);
+       }
++
++      hildon_desktop_panel_expandable_add_in_extension (ex_panel, item);
+     }
+   }
+   else
+@@ -722,18 +714,29 @@
+ {
+   guint n_rows, 
+ 	table_rows,
++        table_columns,
+ 	left_attach,
+ 	right_attach,
+ 	top_attach,
+ 	bottom_attach,
+ 	division,
++        width,
+ 	n_items;
++  GdkScreen *screen;
+ 
+   n_items = (panel->priv->arrow != NULL) ? panel->priv->n_items+1 : panel->priv->n_items;
+ 
+   division = ((guint)((n_items+1) / panel->priv->items_p_row));
+ 
+   n_rows = division + (((n_items+1) % panel->priv->items_p_row) != 0) ? 1 : 0;
++
++  screen = gtk_widget_get_screen (GTK_WIDGET(panel));
++  if (screen != NULL)
++    width = gdk_screen_get_width(screen);
++  else
++    width = 1024;
++
++  table_columns = width / HSB_ITEM_WIDTH;
+   
+   g_object_get (panel->priv->extension_table, "n-rows", &table_rows, NULL);
+ 
+@@ -742,10 +745,10 @@
+     if (HILDON_DESKTOP_PANEL (panel)->orient == GTK_ORIENTATION_HORIZONTAL)
+       gtk_table_resize (panel->priv->extension_table,
+ 		        n_rows,
+-		        panel->priv->items_p_row);
++		        table_columns);
+     else
+       gtk_table_resize (panel->priv->extension_table,
+-		        panel->priv->items_p_row,
++		        table_columns,
+ 		        n_rows);
+   }
+ 
+@@ -810,8 +813,15 @@
+    if (p1 < p2) 
+      return -1;
+    else 
+-   if (p1 == p2) 
+-    return 0;
++   if (p1 == p2)
++   {
++      if (!STATUSBAR_IS_ITEM_SOCKET(a))
++         return 1;
++      else if (!STATUSBAR_IS_ITEM_SOCKET(b))
++         return -1;
++      else
++         return 0;
++   }
+    else 
+     return 1;
+ }
+@@ -859,6 +869,11 @@
+     g_list_sort (panel->priv->queued_items,
+      	         (GCompareFunc)hildon_desktop_panel_expandable_sort_items);
+ 
++  if (g_list_length (panel->priv->queued_items) > panel->priv->items_p_row )
++    panel->priv->extension_used = TRUE;
++  else
++    panel->priv->extension_used = FALSE;
++
+   for (l = panel->priv->queued_items; l; l = g_list_next (l))
+   {
+     hildon_desktop_panel_expandable_add_button (HILDON_DESKTOP_PANEL (panel),
+@@ -992,33 +1007,6 @@
+   hildon_desktop_panel_expandable_arrange_items (panel);  
+ }
+ 
+-static void 
+-hildon_desktop_panel_expandable_requeue_last_in_panel (HildonDesktopPanelExpandable *panel)
+-{
+-  GList *l, *children = gtk_container_get_children (GTK_CONTAINER (panel));
+-  HildonDesktopPanelItem *item;
+-
+-  if (!children)
+-    return;
+-
+-  l = children;
+-
+-  while (GTK_WIDGET (l->data) == panel->priv->arrow)
+-    l = l->next;	  
+-  
+-  item = HILDON_DESKTOP_PANEL_ITEM (l->data);
+-
+-  g_object_ref (G_OBJECT (item));
+-
+-  gtk_container_remove (GTK_CONTAINER (panel), GTK_WIDGET (item));
+-
+-  hildon_desktop_panel_expandable_add_in_extension (panel, item);
+-  
+-  g_object_unref (G_OBJECT (item));
+-
+-  panel->priv->n_items--;
+-}	
+-
+ #ifdef SYSTRAY_SUPPORT
+ static void 
+ hildon_desktop_panel_expandable_init_systray (HildonDesktopPanelExpandable *panel, gpointer data)
+diff -Nur hildon-desktop/libhildondesktop/tasknavigator-item.c hildon-desktop-new/libhildondesktop/tasknavigator-item.c
+--- hildon-desktop/libhildondesktop/tasknavigator-item.c	2008-02-22 16:56:54.000000000 +0800
++++ hildon-desktop-new/libhildondesktop/tasknavigator-item.c	2008-02-22 19:17:35.000000000 +0800
+@@ -33,6 +33,7 @@
+ G_DEFINE_TYPE (TaskNavigatorItem, tasknavigator_item, HILDON_DESKTOP_TYPE_PANEL_ITEM)
+ 
+ /* FIXME: change tasknavigator to task_navigator or TaskNavigator to Tasknavigator */
++void tasknavigator_item_screen_changed (GdkScreen *screen, TaskNavigatorItem *item);
+ 
+ static void
+ tasknavigator_item_class_init (TaskNavigatorItemClass *klass)
+@@ -43,4 +44,15 @@
+ tasknavigator_item_init (TaskNavigatorItem *self)
+ {
+   self->menu   = NULL;
++  GdkScreen *screen;
++
++  screen = gtk_widget_get_screen (GTK_WIDGET(self));
++
++  g_signal_connect (G_OBJECT(screen), "size-changed", G_CALLBACK(tasknavigator_item_screen_changed), self);
++}
++
++void
++tasknavigator_item_screen_changed (GdkScreen *screen, TaskNavigatorItem *item)
++{
++  return TASKNAVIGATOR_ITEM_GET_CLASS (item)->screen_changed (item);
+ }
+diff -Nur hildon-desktop/libhildondesktop/tasknavigator-item.h hildon-desktop-new/libhildondesktop/tasknavigator-item.h
+--- hildon-desktop/libhildondesktop/tasknavigator-item.h	2008-02-22 16:56:54.000000000 +0800
++++ hildon-desktop-new/libhildondesktop/tasknavigator-item.h	2008-02-22 19:17:35.000000000 +0800
+@@ -37,6 +37,7 @@
+ #define TASKNAVIGATOR_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TASKNAVIGATOR_TYPE_ITEM, TaskNavigatorItemClass))
+ #define TASKNAVIGATOR_IS_ITEM(obj) (GTK_CHECK_TYPE (obj, TASKNAVIGATOR_TYPE_ITEM))
+ #define TASKNAVIGATOR_IS_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TASKNAVIGATOR_TYPE_ITEM))
++#define TASKNAVIGATOR_ITEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), TASKNAVIGATOR_TYPE_ITEM, TaskNavigatorItemClass))
+ 
+ 
+ typedef struct _TaskNavigatorItem TaskNavigatorItem;
+@@ -60,6 +61,8 @@
+ struct _TaskNavigatorItemClass
+ {
+     HildonDesktopPanelItemClass parent_class;
++
++    void (* screen_changed) (TaskNavigatorItem *item);
+ };
+ 
+ GType tasknavigator_item_get_type (void);
+diff -Nur hildon-desktop/src/hm-statusbar-container.c hildon-desktop-new/src/hm-statusbar-container.c
+--- hildon-desktop/src/hm-statusbar-container.c	2008-02-22 16:58:12.000000000 +0800
++++ hildon-desktop-new/src/hm-statusbar-container.c	2008-02-22 19:17:35.000000000 +0800
+@@ -46,6 +46,7 @@
+    GObject *pm;
+ };
+ 
++void statusbar_container_screen_changed (TaskNavigatorItem *item);
+ static void statusbar_container_finalize (GObject *object);
+ 
+ static GList *
+@@ -113,7 +114,7 @@
+ static void statusbar_container_init (StatusbarContainer *statusbar_container)
+ {
+    GtkContainer *statusbar = NULL;
+-   int scn_width = 800;
++   int scn_width = 800, plugin_width;
+    GdkScreen *screen = NULL;
+    GList *plugin_list = NULL;
+ 
+@@ -123,10 +124,15 @@
+    statusbar_container->priv->hdwm = hd_wm_get_singleton ();
+    statusbar_container->priv->pm = hd_plugin_manager_new ();
+ 
++   screen = gtk_widget_get_screen (GTK_WIDGET(statusbar_container));
++   if (screen != NULL) {
++      scn_width = gdk_screen_get_width(screen);
++   }
++
+    g_object_ref (statusbar_container->priv->hdwm);
+    gtk_widget_push_composite_child ();
+ 
+-   statusbar = g_object_new (HILDON_DESKTOP_TYPE_PANEL_EXPANDABLE, "items_row", 7,NULL);
++   statusbar = g_object_new (HILDON_DESKTOP_TYPE_PANEL_EXPANDABLE, "items_row", (3 + scn_width / 320), NULL);
+ 
+    //Hard code orientation as horizontal first, this should get from marquee orientation ultmately.
+    if (NULL != statusbar)
+@@ -142,12 +148,8 @@
+                   NULL);
+    }
+ 
+-   screen = gtk_widget_get_screen ((GtkWidget*)statusbar_container);
+-   if (screen != NULL) {
+-      scn_width = gdk_screen_get_width(screen);
+-   }
+-
+-   gtk_widget_set_size_request ((GtkWidget*)statusbar_container, (scn_width == 1024?303:200), 52);
++   plugin_width = 52 * (3 + scn_width / 320);
++   gtk_widget_set_size_request ((GtkWidget*)statusbar_container, plugin_width, 52);
+ 
+    plugin_list = plugin_list_from_conf (STATUSBAR_CONFIG);
+    hd_plugin_manager_load (HD_PLUGIN_MANAGER (statusbar_container->priv->pm),
+@@ -163,9 +165,26 @@
+    gtk_widget_pop_composite_child ();
+ }
+ 
++void statusbar_container_screen_changed (TaskNavigatorItem *item)
++{
++  StatusbarContainer *statusbar_container = (StatusbarContainer *)item;
++  StatusbarContainerPrivate *priv = HM_STATUSBAR_CONTAINER_GET_PRIVATE (statusbar_container);
++  GdkScreen *screen = gdk_screen_get_default ();
++  gint scn_width = 800, width;
++  scn_width = gdk_screen_get_width (screen);
++
++  width = 52 * (3 + scn_width / 320);
++  g_object_set (G_OBJECT (priv->statusbar), "items_row", (width / 52), NULL);
++  g_print ("statusbar_container_screen_changed: new width %d\n", width);
++  gtk_widget_set_size_request (GTK_WIDGET(statusbar_container), width, 52);
++}
++
+ static void statusbar_container_class_init (StatusbarContainerClass *class)
+ {
+   GObjectClass   *object_class = G_OBJECT_CLASS (class);
++  TaskNavigatorItemClass *item_class = TASKNAVIGATOR_ITEM_CLASS (class);
++
++  item_class->screen_changed = statusbar_container_screen_changed;
+   object_class->finalize    = statusbar_container_finalize;
+   g_type_class_add_private (object_class, sizeof (StatusbarContainerPrivate));
+ }

=== added file 'debian/patches/22_fast_reboot.patch'
--- a/debian/patches/22_fast_reboot.patch	1970-01-01 00:00:00 +0000
+++ b/debian/patches/22_fast_reboot.patch	2008-02-26 05:48:02 +0000
@@ -0,0 +1,34 @@
+diff -Nur hildon-desktop/debian/config/desktop.conf hildon-desktop-new/debian/config/desktop.conf
+--- hildon-desktop/debian/config/desktop.conf	2008-02-22 19:17:35.000000000 +0800
++++ hildon-desktop-new/debian/config/desktop.conf	2008-02-22 20:01:57.000000000 +0800
+@@ -1,3 +1,14 @@
++[Home]
++X-Type=home
++X-Padding-Left=0
++X-Padding-Right=0
++X-Padding-Top=0
++X-Padding-Bottom=0
++X-Is-Ordered=0
++X-Load-New-Plugins=1
++X-Config-File=home.conf
++X-Plugin-Dir=/usr/share/applications/hildon-home;~/.hildon-home
++
+ [Marquee]
+ X-Type=panel_box
+ X-Position-X=0
+@@ -9,14 +20,3 @@
+ X-Config-File=marquee.conf
+ X-Hide-On-Home=0
+ X-Plugin-Dir=/usr/share/applications/hildon-marquee
+-
+-[Home]
+-X-Type=home
+-X-Padding-Left=0
+-X-Padding-Right=0
+-X-Padding-Top=0
+-X-Padding-Bottom=0
+-X-Is-Ordered=0
+-X-Load-New-Plugins=1
+-X-Config-File=home.conf
+-X-Plugin-Dir=/usr/share/applications/hildon-home;~/.hildon-home
+\ No newline at end of file



More information about the pkg-maemo-commits mailing list