r1382 - trunk/src/target/OM-2007/applications/openmoko-taskmanager/src

zhiyong_sun at sita.openmoko.org zhiyong_sun at sita.openmoko.org
Fri Mar 16 04:25:06 CET 2007


Author: zhiyong_sun
Date: 2007-03-16 04:24:40 +0100 (Fri, 16 Mar 2007)
New Revision: 1382

Modified:
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c
   trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h
Log:
delete '^M' 

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,226 +1,226 @@
-/**
- *  callbacks.c
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include "callbacks.h"
-
-GdkFilterReturn
-moko_window_filter (GdkXEvent *xev, GdkEvent *gev, MokoTaskList*l) 
-{
-    XEvent *ev = (XEvent *)xev;
-    Display *dpy = ev->xany.display;
-
-    if (ev->xany.type == PropertyNotify
-      	 && ev->xproperty.window == DefaultRootWindow (dpy)) {
-        if (ev->xproperty.atom == atoms[_NET_CLIENT_LIST])	{
-		moko_update_store_list(dpy, l->list_store);
-      	 }
-      	 else if (ev->xproperty.atom == atoms[_NET_ACTIVE_WINDOW]) {
-		moko_set_list_highlight (dpy, l);
-      	 }
-    }
-    return GDK_FILTER_CONTINUE;
-}
-
-gboolean
-moko_wm_cmd (GtkWidget *w, GtkWidget *list_view, int task)
-{
-    GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view));
-    GtkTreeIter iter;
-    GtkTreeModel *model;
-
-    if (gtk_tree_selection_get_selected (sel, &model, &iter)) 
-    	{
-    	  Window w;
-
-    	  gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &w, -1);
-    	  mbcommand(GDK_DISPLAY(), task, w, NULL);
-    	  return TRUE;
-    	  }
-    else 
-    	{
-    	  /*GtkMessageDialog* dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel(w)),
- 							GTK_DIALOG_DESTROY_WITH_PARENT,
-		                                   GTK_MESSAGE_ERROR,      
-		                                   GTK_BUTTONS_CLOSE,
-		                                   "No Application selected..." );
-	  gtk_dialog_run (GTK_DIALOG (dialog));
-	  gtk_widget_destroy(GTK_WIDGET(dialog));
-	  return TRUE;
-	  */
-	  g_debug ("send message to footer");
-    	  return FALSE;
-    	  }
-}
-
-gboolean 
-moko_cursor_changed(GtkTreeView *treeview, GtkTreeModel *model)
-{
-    g_debug ("Tab event");
-    
-}
-
-
-void
-moko_go_to_btn_cb (GtkButton *btn, MokoTaskManager *tm)
-{
-    if (!tm)
-    	return;
-    moko_wm_cmd (GTK_WIDGET (tm), 
-    			GTK_WIDGET (tm->l->list_view), MB_CMD_ACTIVATE_CLIENT);
-}
-
-void
-moko_kill_btn_cb (GtkButton *btn, MokoTaskManager *tm)
-{
-    if (!tm)
-    	return;
-    moko_wm_cmd (GTK_WIDGET (tm), 
-    			GTK_WIDGET (tm->l->list_view), MB_CMD_REMOVE_CLIENT);
-}
-
-void
-moko_kill_all_btn_cb (GtkButton *btn, MokoTaskManager *tm)
-{    
-    GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
-    GtkTreeIter iter;
-    GtkTreeModel *model;
-    Window *win;
-    GSList *list = NULL;
-    
-    gtk_tree_selection_get_selected (sel, &model, &iter);
-
-    if (!gtk_tree_model_get_iter_first (model, &iter))
-    	return;
-    
-    do 
-    	{
-    	gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &win, -1);
-    	list = g_slist_append (list, win);
-    	if (!gtk_tree_model_iter_next (model, &iter))
-    		break;
-    	}
-    while (1);
-
-   do{
-   	mbcommand (GDK_DISPLAY(), MB_CMD_REMOVE_CLIENT, list->data, NULL); 
-   	g_debug ("%d", list->data);
-  
-	}
-    while (list = g_slist_next (list));
-    	  /*Window w;
-
-    	  gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &w, -1);
-    	  mbcommand(GDK_DISPLAY(), task, w, NULL);
-    	  return TRUE;
-    	  }
-*/
-  if (list)
- 	g_slist_free (list);
-}
-void
-moko_quit_btn_cb (GtkButton *btn, MokoTaskManager *tm)
-{
-    if (!tm)
-    	return;
-
-    gtk_window_iconify (GTK_WINDOW (tm->window));
-}
-
-void
-moko_tab_event_cb (GtkButton *btn, MokoTaskList *l) 
-{
-    g_debug ("tab event");
-    GtkTreeIter iter;
-    GtkTreePath *path;
-    GtkTreeViewColumn *col;
-    GtkTreeModel *model;
-
-    gtk_tree_view_get_cursor(GTK_TREE_VIEW (l->list_view), &path, &col);
-    //gtk_tree_view_get_cursor(l->mokolist_view, &path, &col);
-
-    model = GTK_TREE_MODEL (l->list_store);
-
-    if (gtk_tree_model_get_iter (model, &iter, path)) {
-        Window w;
-        gtk_tree_model_get (model, &iter, OBJECT_COL, &w, -1);
-        //moko_print_win_list(GDK_DISPLAY(), &w, 1);
-        //moko_send_Xclimsgwm(GDK_DISPLAY (), w);
-        mbcommand(GDK_DISPLAY(), MB_CMD_ACTIVATE_CLIENT, w, NULL);
-        }
-    if (path)
-    	free (path);
-}
-
-void        
-moko_hold_event_cb (GtkButton *btn, MokoTaskList *l) 
-{
-    moko_init_popup_menu(NULL, NULL, l);
- }
-
-void
-moko_wheel_left_up_press_cb (GtkWidget *self, MokoTaskManager *tm)
-{
-   GtkTreeSelection    *selection;
-   GtkTreeModel        *model;
-   GtkTreeIter         iter;
-   GtkTreePath* path;
-
-   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
-
-   if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-	 return;
-   
-   path = gtk_tree_model_get_path (model, &iter);
-   if (!gtk_tree_path_prev (path))
-   {
-	gtk_tree_path_free (path);
-	return;
-   }
-   
-   gtk_tree_view_set_cursor (GTK_TREE_VIEW (tm->l->list_view), path, 0, 0);
-   gtk_tree_path_free (path);
-   return;
-}
-
-void
-moko_wheel_right_down_press_cb (GtkWidget *self, MokoTaskManager *tm)
-{
-   GtkTreeSelection    *selection;
-   GtkTreeModel        *model;
-   GtkTreeIter         iter;
-   GtkTreePath* path;
-
-   if (!tm->l->list_view)
- 	return;
-	 
-   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
-
-   if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-	 return;
-   
-   path = gtk_tree_model_get_path (model, &iter);
-   gtk_tree_path_next (path);
-   
-   if (!path)
-	return;
-     
-   gtk_tree_view_set_cursor (GTK_TREE_VIEW (tm->l->list_view), path, 0, 0);
-   gtk_tree_path_free (path);
-   return;
- }
+/**
+ *  callbacks.c
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "callbacks.h"
+
+GdkFilterReturn
+moko_window_filter (GdkXEvent *xev, GdkEvent *gev, MokoTaskList*l) 
+{
+    XEvent *ev = (XEvent *)xev;
+    Display *dpy = ev->xany.display;
+
+    if (ev->xany.type == PropertyNotify
+      	 && ev->xproperty.window == DefaultRootWindow (dpy)) {
+        if (ev->xproperty.atom == atoms[_NET_CLIENT_LIST])	{
+		moko_update_store_list(dpy, l->list_store);
+      	 }
+      	 else if (ev->xproperty.atom == atoms[_NET_ACTIVE_WINDOW]) {
+		moko_set_list_highlight (dpy, l);
+      	 }
+    }
+    return GDK_FILTER_CONTINUE;
+}
+
+gboolean
+moko_wm_cmd (GtkWidget *w, GtkWidget *list_view, int task)
+{
+    GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view));
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+
+    if (gtk_tree_selection_get_selected (sel, &model, &iter)) 
+    	{
+    	  Window w;
+
+    	  gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &w, -1);
+    	  mbcommand(GDK_DISPLAY(), task, w, NULL);
+    	  return TRUE;
+    	  }
+    else 
+    	{
+    	  /*GtkMessageDialog* dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel(w)),
+ 							GTK_DIALOG_DESTROY_WITH_PARENT,
+		                                   GTK_MESSAGE_ERROR,      
+		                                   GTK_BUTTONS_CLOSE,
+		                                   "No Application selected..." );
+	  gtk_dialog_run (GTK_DIALOG (dialog));
+	  gtk_widget_destroy(GTK_WIDGET(dialog));
+	  return TRUE;
+	  */
+	  g_debug ("send message to footer");
+    	  return FALSE;
+    	  }
+}
+
+gboolean 
+moko_cursor_changed(GtkTreeView *treeview, GtkTreeModel *model)
+{
+    g_debug ("Tab event");
+    
+}
+
+
+void
+moko_go_to_btn_cb (GtkButton *btn, MokoTaskManager *tm)
+{
+    if (!tm)
+    	return;
+    moko_wm_cmd (GTK_WIDGET (tm), 
+    			GTK_WIDGET (tm->l->list_view), MB_CMD_ACTIVATE_CLIENT);
+}
+
+void
+moko_kill_btn_cb (GtkButton *btn, MokoTaskManager *tm)
+{
+    if (!tm)
+    	return;
+    moko_wm_cmd (GTK_WIDGET (tm), 
+    			GTK_WIDGET (tm->l->list_view), MB_CMD_REMOVE_CLIENT);
+}
+
+void
+moko_kill_all_btn_cb (GtkButton *btn, MokoTaskManager *tm)
+{    
+    GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+    Window *win;
+    GSList *list = NULL;
+    
+    gtk_tree_selection_get_selected (sel, &model, &iter);
+
+    if (!gtk_tree_model_get_iter_first (model, &iter))
+    	return;
+    
+    do 
+    	{
+    	gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &win, -1);
+    	list = g_slist_append (list, win);
+    	if (!gtk_tree_model_iter_next (model, &iter))
+    		break;
+    	}
+    while (1);
+
+   do{
+   	mbcommand (GDK_DISPLAY(), MB_CMD_REMOVE_CLIENT, list->data, NULL); 
+   	g_debug ("%d", list->data);
+  
+	}
+    while (list = g_slist_next (list));
+    	  /*Window w;
+
+    	  gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &w, -1);
+    	  mbcommand(GDK_DISPLAY(), task, w, NULL);
+    	  return TRUE;
+    	  }
+*/
+  if (list)
+ 	g_slist_free (list);
+}
+void
+moko_quit_btn_cb (GtkButton *btn, MokoTaskManager *tm)
+{
+    if (!tm)
+    	return;
+
+    gtk_window_iconify (GTK_WINDOW (tm->window));
+}
+
+void
+moko_tab_event_cb (GtkButton *btn, MokoTaskList *l) 
+{
+    g_debug ("tab event");
+    GtkTreeIter iter;
+    GtkTreePath *path;
+    GtkTreeViewColumn *col;
+    GtkTreeModel *model;
+
+    gtk_tree_view_get_cursor(GTK_TREE_VIEW (l->list_view), &path, &col);
+    //gtk_tree_view_get_cursor(l->mokolist_view, &path, &col);
+
+    model = GTK_TREE_MODEL (l->list_store);
+
+    if (gtk_tree_model_get_iter (model, &iter, path)) {
+        Window w;
+        gtk_tree_model_get (model, &iter, OBJECT_COL, &w, -1);
+        //moko_print_win_list(GDK_DISPLAY(), &w, 1);
+        //moko_send_Xclimsgwm(GDK_DISPLAY (), w);
+        mbcommand(GDK_DISPLAY(), MB_CMD_ACTIVATE_CLIENT, w, NULL);
+        }
+    if (path)
+    	free (path);
+}
+
+void        
+moko_hold_event_cb (GtkButton *btn, MokoTaskList *l) 
+{
+    moko_init_popup_menu(NULL, NULL, l);
+ }
+
+void
+moko_wheel_left_up_press_cb (GtkWidget *self, MokoTaskManager *tm)
+{
+   GtkTreeSelection    *selection;
+   GtkTreeModel        *model;
+   GtkTreeIter         iter;
+   GtkTreePath* path;
+
+   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
+
+   if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+	 return;
+   
+   path = gtk_tree_model_get_path (model, &iter);
+   if (!gtk_tree_path_prev (path))
+   {
+	gtk_tree_path_free (path);
+	return;
+   }
+   
+   gtk_tree_view_set_cursor (GTK_TREE_VIEW (tm->l->list_view), path, 0, 0);
+   gtk_tree_path_free (path);
+   return;
+}
+
+void
+moko_wheel_right_down_press_cb (GtkWidget *self, MokoTaskManager *tm)
+{
+   GtkTreeSelection    *selection;
+   GtkTreeModel        *model;
+   GtkTreeIter         iter;
+   GtkTreePath* path;
+
+   if (!tm->l->list_view)
+ 	return;
+	 
+   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
+
+   if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+	 return;
+   
+   path = gtk_tree_model_get_path (model, &iter);
+   gtk_tree_path_next (path);
+   
+   if (!path)
+	return;
+     
+   gtk_tree_view_set_cursor (GTK_TREE_VIEW (tm->l->list_view), path, 0, 0);
+   gtk_tree_path_free (path);
+   return;
+ }

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,76 +1,76 @@
-/**
- *  callbacks.h
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _TASK_MANAGER_CALLBACKS_H
-#define _TASK_MANAGER_CALLBACKS_H
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-#include <X11/Xlib.h>
-
-#include "taskmanager.h"
-#include "misc.h"
-#include "list_view.h"
-#include "xatoms.h"
-#include "popupmenu.h"
-
-GdkFilterReturn
-moko_window_filter (GdkXEvent *xev, GdkEvent *gev, MokoTaskList*l);
-
-void
-moko_activate_task (GtkWidget *w, GtkWidget *list_view);
-
-gboolean
-moko_kill_task (GtkWidget *w, GtkWidget *list_view);
-
-void
-moko_row_activated (GtkTreeView *treeview, GtkTreePath *path, 
-			GtkTreeViewColumn *col, GtkTreeModel *model);
-
-gboolean 
-moko_cursor_changed(GtkTreeView *treeview, GtkTreeModel *model);
-
-void
-moko_quit_btn_cb (GtkButton *btn, MokoTaskManager *tm);
-
-void
-moko_kill_btn_cb (GtkButton *btn, MokoTaskManager *tm);
-
-void
-moko_kill_all_btn_cb (GtkButton *btn, MokoTaskManager *tm);
-
-void
-moko_go_to_btn_cb (GtkButton *btn, MokoTaskManager *tm);
-
-void
-moko_tab_event_cb (GtkButton *btn, MokoTaskList *l);
-
-void        
-moko_hold_event_cb (GtkButton *btn, MokoTaskList *l);
-
-void
-moko_wheel_left_up_press_cb (GtkWidget *self, MokoTaskManager *tm);
-
-void
-moko_wheel_right_down_press_cb (GtkWidget *self, MokoTaskManager *tm);
-
-void
-moko_wheel_bottom_press_cb (GtkWidget *self, MokoTaskManager *tm);
-
-
-#endif /*callbacks.h*/
+/**
+ *  callbacks.h
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _TASK_MANAGER_CALLBACKS_H
+#define _TASK_MANAGER_CALLBACKS_H
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <X11/Xlib.h>
+
+#include "taskmanager.h"
+#include "misc.h"
+#include "list_view.h"
+#include "xatoms.h"
+#include "popupmenu.h"
+
+GdkFilterReturn
+moko_window_filter (GdkXEvent *xev, GdkEvent *gev, MokoTaskList*l);
+
+void
+moko_activate_task (GtkWidget *w, GtkWidget *list_view);
+
+gboolean
+moko_kill_task (GtkWidget *w, GtkWidget *list_view);
+
+void
+moko_row_activated (GtkTreeView *treeview, GtkTreePath *path, 
+			GtkTreeViewColumn *col, GtkTreeModel *model);
+
+gboolean 
+moko_cursor_changed(GtkTreeView *treeview, GtkTreeModel *model);
+
+void
+moko_quit_btn_cb (GtkButton *btn, MokoTaskManager *tm);
+
+void
+moko_kill_btn_cb (GtkButton *btn, MokoTaskManager *tm);
+
+void
+moko_kill_all_btn_cb (GtkButton *btn, MokoTaskManager *tm);
+
+void
+moko_go_to_btn_cb (GtkButton *btn, MokoTaskManager *tm);
+
+void
+moko_tab_event_cb (GtkButton *btn, MokoTaskList *l);
+
+void        
+moko_hold_event_cb (GtkButton *btn, MokoTaskList *l);
+
+void
+moko_wheel_left_up_press_cb (GtkWidget *self, MokoTaskManager *tm);
+
+void
+moko_wheel_right_down_press_cb (GtkWidget *self, MokoTaskManager *tm);
+
+void
+moko_wheel_bottom_press_cb (GtkWidget *self, MokoTaskManager *tm);
+
+
+#endif /*callbacks.h*/

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,281 +1,281 @@
-/**
- *  list_view.c
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include "list_view.h"
-#include <gdk/gdk.h>
-
-static GdkPixbuf *default_icon;
-
-enum {
-    LIST_SIGNAL,
-    LAST_SIGNAL
-};
-
-static void moko_task_list_class_init          (MokoTaskListClass *klass);
-static void moko_task_list_init                (MokoTaskList *l);
-
-static guint list_signals[LAST_SIGNAL] = { 0 };
-
-/**
-*@brief retrun MokoTaskList type.
-*@param none
-*@return GType
-*/
-GType moko_task_list_get_type (void) /* Typechecking */
-{
-    static GType list_type = 0;
-
-    if (!list_type)
-    {
-        static const GTypeInfo list_info =
-        {
-            sizeof (MokoTaskListClass),
-            NULL, /* base_init */
-            NULL, /* base_finalize */
-            (GClassInitFunc) moko_task_list_class_init,
-            NULL, /* class_finalize */
-            NULL, /* class_data */
-            sizeof (MokoTaskList),
-            0,
-            (GInstanceInitFunc) moko_task_list_init,
-            NULL
-        };
-
-        list_type = g_type_register_static (GTK_TYPE_VBOX, "MokoTaskList", &list_info, 0);
-    }
-
-    return list_type;
-}
-
-/**
-*@brief initialize MokoTaskList class.
-*@param klass	MokoTaskList Class
-*@return none
-*/
-static void moko_task_list_class_init(MokoTaskListClass * Klass) /* Class Initialization */
-{
-    list_signals[LIST_SIGNAL] = g_signal_new ("list",
-            G_TYPE_FROM_CLASS (Klass),
-            G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
-            G_STRUCT_OFFSET (MokoTaskListClass, list),
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__VOID,
-            G_TYPE_NONE, 
-            0);
-}
-
-/**
-*@brief initialize MokoTaskList UI.
-*@param l	MokoTaskList instance
-*@return none
-*/
-static void /* Instance Construction */
-moko_task_list_init (MokoTaskList *l) 
-{ 
-    GtkCellRenderer *renderer;
-    GtkTreeViewColumn *column;
-   // GtkWidget *ico;
-    GtkWidget *align;
-
-    align=gtk_alignment_new(0, 0, 1, 1);    
-    gtk_alignment_set_padding(GTK_ALIGNMENT (align), 0, 150, 0, 0);
-    l->list_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_PIXBUF);
-    l->list_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (l->list_store));
-    gtk_widget_set_name (l->list_view, "gtktreeview-black");
-    gtk_widget_show (l->list_view);
-    //l->mokolist_view = moko_tree_view_new_with_model (GTK_TREE_MODEL (l->list_store));
-    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (l->list_view), FALSE);
-    //gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (l->mokolist_view), FALSE);
-    
-   /* l->renderer = gtk_cell_renderer_pixbuf_new ();
-    l->column = gtk_tree_view_column_new_with_attributes ("Icon", l->renderer, "pixbuf", 2, NULL);
-    gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), l->column);
-    //moko_tree_view_append_column (GTK_TREE_VIEW (l->mokolist_view), l->column);
-
-    l->renderer = gtk_cell_renderer_text_new ();
-    l->column = gtk_tree_view_column_new_with_attributes ("Running programs", l->renderer, 
-    													"text", 0, NULL);
-   gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), l->column);
-  		*/
-
-   column = gtk_tree_view_column_new();
-   gtk_tree_view_column_set_title (column, ("Task list"));
-   gtk_tree_view_column_set_resizable (column, TRUE);
-  
-    renderer = gtk_cell_renderer_pixbuf_new ();
-   gtk_tree_view_column_pack_start (column,  renderer , FALSE);
-   gtk_tree_view_column_set_attributes (column,  renderer , 
-  				"pixbuf", PIXBUF_COL, NULL);
-
-   renderer = gtk_cell_renderer_text_new ();
-   gtk_tree_view_column_pack_start (column,  renderer , FALSE);
-   gtk_tree_view_column_set_attributes(column,  renderer , 
-   				"text", TEXT_COL, NULL);
-  
-   gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), column);
-		
-    l->scrolled = gtk_scrolled_window_new (NULL, NULL);
-    gtk_widget_show (l->scrolled);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (l->scrolled),
-				  GTK_POLICY_NEVER, GTK_POLICY_NEVER);
-    gtk_container_add (GTK_CONTAINER (align), l->list_view);
-    gtk_container_add (GTK_CONTAINER (l->scrolled), align);
-    gtk_widget_set_size_request (l->scrolled, -1, 400);
-   
-    //l->scrolled = moko_tree_view_put_into_scrolled_window (l->mokolist_view);
-
-    //gtk_box_pack_start (GTK_BOX (l), l->hbox, FALSE, FALSE, 0);
-    //gtk_box_pack_end (l->hbox, l->btn_close, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (l), l->scrolled, TRUE, TRUE, 0);
-    
-    default_icon = gdk_pixbuf_new_from_file_at_size (PKGDATADIR"/default-app-icon.xpm",
-		    					160, 160, NULL);
-    if (!default_icon )
-	    g_error ("Failed to load default icon");
-}
-
-/* Construction */
-GtkWidget* 
-moko_task_list_new() 
-{
-    return GTK_WIDGET(g_object_new(moko_task_list_get_type(), NULL));
-}
-
-/* Destruction */
-void 
-moko_task_list_clear(MokoTaskList *l) { 
-    if (!l) g_free (l);
-}
-
-static void
-moko_add_window (Display *dpy, Window w, GtkListStore *list_store)
-{
-    GtkTreeIter iter;
-    gchar *name = NULL;
-    GdkPixbuf *icon = NULL;
-
-    name = moko_get_window_name(dpy, w);
-    if (!strcmp (name, "Openmoko-taskmanager"))
-    	{
-    	g_free (name);
-    	return;
-    	}
-
-    icon = moko_get_window_icon (dpy, w);
-    gtk_list_store_append (list_store, &iter);
-    gtk_list_store_set (list_store, &iter, TEXT_COL, name, OBJECT_COL, w, -1);
-
-    if (icon) {
-        GdkPixbuf *icons = gdk_pixbuf_scale_simple (icon, 160, 160, GDK_INTERP_BILINEAR);
-        gtk_list_store_set (list_store, &iter, PIXBUF_COL, icons, -1);
-	gdk_pixbuf_unref (icons);
-        }
-    else if (default_icon) 
-        gtk_list_store_set (list_store, &iter, PIXBUF_COL, default_icon, -1);
-    else
-	    g_error ("Failed to load %s's icon", name);
-
-    gdk_pixbuf_unref (icon);
-    g_free (name);
-   }
-
-void 
-moko_update_store_list (Display *dpy, GtkListStore *list_store)
-{
-    Window *list;
-    guint nr, i;
-    GtkTreeIter iter;
-    char *p;
-
-    if (moko_update_net_undocked_client_list (dpy, &list, &nr) == FALSE)
-    	return;
-    p = g_malloc0 (nr);
-
-    if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))	{
-    	gboolean more;
-    do{
-    	gboolean found = FALSE;
-    	Window w;
-    	gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter, OBJECT_COL, &w, -1);
-    	for (i=0; i<nr; i++) {
-    	    if (list[i] == w) {
-    	    	p[i] = 1;
-    	    	found = TRUE;
-    	    	break;
-    	    	}
-    	    }
-    	if (found)
-    	    more = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter);
-    	else
-    	    more = gtk_list_store_remove (list_store, &iter);
-    	}
-    while (more);
-    }
-    
-    for (i=0; i<nr; i++) {
-    	if (p[i] == 0 && list[i] != my_win)
-    	    moko_add_window (dpy, list[i], list_store);
-    	}
-
-  	g_free (p);
-}
-
-void 
-moko_set_list_highlight (Display *dpy, MokoTaskList *l) 
-{
-    Window *wp;
-    Atom type;
-    int format;
-    unsigned long nitems;
-    unsigned long bytes_after;
-  
-    if (XGetWindowProperty (dpy, DefaultRootWindow (dpy), atoms[_NET_ACTIVE_WINDOW],
-			  0, 4, False, XA_WINDOW, &type, &format, &nitems, &bytes_after, 
-			  (unsigned char **)&wp) == Success)	
-    {
-        if (wp)
-        {
-            Window w;
-            w = *wp;
-            if (w != 0 && w != my_win) 
-            {
-                GtkTreeIter iter;
-                if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (l->list_store), &iter))	
-                {
-                    Window iw;
-                    do 
-                    	{
-                        gtk_tree_model_get (GTK_TREE_MODEL (l->list_store), &iter, OBJECT_COL, &iw, -1);
-                        if (iw == w)
-                        {
-                            GtkTreePath *path;
-                            path = gtk_tree_model_get_path (GTK_TREE_MODEL (l->list_store), &iter);
-                            gtk_tree_view_set_cursor (GTK_TREE_VIEW (l->list_view), path, NULL, FALSE);
-                            gtk_tree_path_free (path);
-                            break;
-                        }
-                      }while (gtk_tree_model_iter_next (GTK_TREE_MODEL (l->list_store), &iter));
-                   }
-              }
-          XFree (wp);
-         }
-    }
-}
-
+/**
+ *  list_view.c
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "list_view.h"
+#include <gdk/gdk.h>
+
+static GdkPixbuf *default_icon;
+
+enum {
+    LIST_SIGNAL,
+    LAST_SIGNAL
+};
+
+static void moko_task_list_class_init          (MokoTaskListClass *klass);
+static void moko_task_list_init                (MokoTaskList *l);
+
+static guint list_signals[LAST_SIGNAL] = { 0 };
+
+/**
+*@brief retrun MokoTaskList type.
+*@param none
+*@return GType
+*/
+GType moko_task_list_get_type (void) /* Typechecking */
+{
+    static GType list_type = 0;
+
+    if (!list_type)
+    {
+        static const GTypeInfo list_info =
+        {
+            sizeof (MokoTaskListClass),
+            NULL, /* base_init */
+            NULL, /* base_finalize */
+            (GClassInitFunc) moko_task_list_class_init,
+            NULL, /* class_finalize */
+            NULL, /* class_data */
+            sizeof (MokoTaskList),
+            0,
+            (GInstanceInitFunc) moko_task_list_init,
+            NULL
+        };
+
+        list_type = g_type_register_static (GTK_TYPE_VBOX, "MokoTaskList", &list_info, 0);
+    }
+
+    return list_type;
+}
+
+/**
+*@brief initialize MokoTaskList class.
+*@param klass	MokoTaskList Class
+*@return none
+*/
+static void moko_task_list_class_init(MokoTaskListClass * Klass) /* Class Initialization */
+{
+    list_signals[LIST_SIGNAL] = g_signal_new ("list",
+            G_TYPE_FROM_CLASS (Klass),
+            G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+            G_STRUCT_OFFSET (MokoTaskListClass, list),
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 
+            0);
+}
+
+/**
+*@brief initialize MokoTaskList UI.
+*@param l	MokoTaskList instance
+*@return none
+*/
+static void /* Instance Construction */
+moko_task_list_init (MokoTaskList *l) 
+{ 
+    GtkCellRenderer *renderer;
+    GtkTreeViewColumn *column;
+   // GtkWidget *ico;
+    GtkWidget *align;
+
+    align=gtk_alignment_new(0, 0, 1, 1);    
+    gtk_alignment_set_padding(GTK_ALIGNMENT (align), 0, 150, 0, 0);
+    l->list_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_PIXBUF);
+    l->list_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (l->list_store));
+    gtk_widget_set_name (l->list_view, "gtktreeview-black");
+    gtk_widget_show (l->list_view);
+    //l->mokolist_view = moko_tree_view_new_with_model (GTK_TREE_MODEL (l->list_store));
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (l->list_view), FALSE);
+    //gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (l->mokolist_view), FALSE);
+    
+   /* l->renderer = gtk_cell_renderer_pixbuf_new ();
+    l->column = gtk_tree_view_column_new_with_attributes ("Icon", l->renderer, "pixbuf", 2, NULL);
+    gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), l->column);
+    //moko_tree_view_append_column (GTK_TREE_VIEW (l->mokolist_view), l->column);
+
+    l->renderer = gtk_cell_renderer_text_new ();
+    l->column = gtk_tree_view_column_new_with_attributes ("Running programs", l->renderer, 
+    													"text", 0, NULL);
+   gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), l->column);
+  		*/
+
+   column = gtk_tree_view_column_new();
+   gtk_tree_view_column_set_title (column, ("Task list"));
+   gtk_tree_view_column_set_resizable (column, TRUE);
+  
+    renderer = gtk_cell_renderer_pixbuf_new ();
+   gtk_tree_view_column_pack_start (column,  renderer , FALSE);
+   gtk_tree_view_column_set_attributes (column,  renderer , 
+  				"pixbuf", PIXBUF_COL, NULL);
+
+   renderer = gtk_cell_renderer_text_new ();
+   gtk_tree_view_column_pack_start (column,  renderer , FALSE);
+   gtk_tree_view_column_set_attributes(column,  renderer , 
+   				"text", TEXT_COL, NULL);
+  
+   gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), column);
+		
+    l->scrolled = gtk_scrolled_window_new (NULL, NULL);
+    gtk_widget_show (l->scrolled);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (l->scrolled),
+				  GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+    gtk_container_add (GTK_CONTAINER (align), l->list_view);
+    gtk_container_add (GTK_CONTAINER (l->scrolled), align);
+    gtk_widget_set_size_request (l->scrolled, -1, 400);
+   
+    //l->scrolled = moko_tree_view_put_into_scrolled_window (l->mokolist_view);
+
+    //gtk_box_pack_start (GTK_BOX (l), l->hbox, FALSE, FALSE, 0);
+    //gtk_box_pack_end (l->hbox, l->btn_close, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (l), l->scrolled, TRUE, TRUE, 0);
+    
+    default_icon = gdk_pixbuf_new_from_file_at_size (PKGDATADIR"/default-app-icon.xpm",
+		    					160, 160, NULL);
+    if (!default_icon )
+	    g_error ("Failed to load default icon");
+}
+
+/* Construction */
+GtkWidget* 
+moko_task_list_new() 
+{
+    return GTK_WIDGET(g_object_new(moko_task_list_get_type(), NULL));
+}
+
+/* Destruction */
+void 
+moko_task_list_clear(MokoTaskList *l) { 
+    if (!l) g_free (l);
+}
+
+static void
+moko_add_window (Display *dpy, Window w, GtkListStore *list_store)
+{
+    GtkTreeIter iter;
+    gchar *name = NULL;
+    GdkPixbuf *icon = NULL;
+
+    name = moko_get_window_name(dpy, w);
+    if (!strcmp (name, "Openmoko-taskmanager"))
+    	{
+    	g_free (name);
+    	return;
+    	}
+
+    icon = moko_get_window_icon (dpy, w);
+    gtk_list_store_append (list_store, &iter);
+    gtk_list_store_set (list_store, &iter, TEXT_COL, name, OBJECT_COL, w, -1);
+
+    if (icon) {
+        GdkPixbuf *icons = gdk_pixbuf_scale_simple (icon, 160, 160, GDK_INTERP_BILINEAR);
+        gtk_list_store_set (list_store, &iter, PIXBUF_COL, icons, -1);
+	gdk_pixbuf_unref (icons);
+        }
+    else if (default_icon) 
+        gtk_list_store_set (list_store, &iter, PIXBUF_COL, default_icon, -1);
+    else
+	    g_error ("Failed to load %s's icon", name);
+
+    gdk_pixbuf_unref (icon);
+    g_free (name);
+   }
+
+void 
+moko_update_store_list (Display *dpy, GtkListStore *list_store)
+{
+    Window *list;
+    guint nr, i;
+    GtkTreeIter iter;
+    char *p;
+
+    if (moko_update_net_undocked_client_list (dpy, &list, &nr) == FALSE)
+    	return;
+    p = g_malloc0 (nr);
+
+    if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))	{
+    	gboolean more;
+    do{
+    	gboolean found = FALSE;
+    	Window w;
+    	gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter, OBJECT_COL, &w, -1);
+    	for (i=0; i<nr; i++) {
+    	    if (list[i] == w) {
+    	    	p[i] = 1;
+    	    	found = TRUE;
+    	    	break;
+    	    	}
+    	    }
+    	if (found)
+    	    more = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter);
+    	else
+    	    more = gtk_list_store_remove (list_store, &iter);
+    	}
+    while (more);
+    }
+    
+    for (i=0; i<nr; i++) {
+    	if (p[i] == 0 && list[i] != my_win)
+    	    moko_add_window (dpy, list[i], list_store);
+    	}
+
+  	g_free (p);
+}
+
+void 
+moko_set_list_highlight (Display *dpy, MokoTaskList *l) 
+{
+    Window *wp;
+    Atom type;
+    int format;
+    unsigned long nitems;
+    unsigned long bytes_after;
+  
+    if (XGetWindowProperty (dpy, DefaultRootWindow (dpy), atoms[_NET_ACTIVE_WINDOW],
+			  0, 4, False, XA_WINDOW, &type, &format, &nitems, &bytes_after, 
+			  (unsigned char **)&wp) == Success)	
+    {
+        if (wp)
+        {
+            Window w;
+            w = *wp;
+            if (w != 0 && w != my_win) 
+            {
+                GtkTreeIter iter;
+                if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (l->list_store), &iter))	
+                {
+                    Window iw;
+                    do 
+                    	{
+                        gtk_tree_model_get (GTK_TREE_MODEL (l->list_store), &iter, OBJECT_COL, &iw, -1);
+                        if (iw == w)
+                        {
+                            GtkTreePath *path;
+                            path = gtk_tree_model_get_path (GTK_TREE_MODEL (l->list_store), &iter);
+                            gtk_tree_view_set_cursor (GTK_TREE_VIEW (l->list_view), path, NULL, FALSE);
+                            gtk_tree_path_free (path);
+                            break;
+                        }
+                      }while (gtk_tree_model_iter_next (GTK_TREE_MODEL (l->list_store), &iter));
+                   }
+              }
+          XFree (wp);
+         }
+    }
+}
+

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,82 +1,82 @@
-/**
- *  list_view.h
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
- 
-#ifndef _MOKO_TASK_MANAGER_LIST_VIEW_H 
-#define _MOKO_TASK_MANAGER_LIST_VIEW_H
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-#include <libmokoui/moko-tree-view.h>
-
-#include "misc.h"
-
-enum{
-    TEXT_COL = 0,
-    OBJECT_COL,
-    PIXBUF_COL,
-    MAX_COL
-};
-
-G_BEGIN_DECLS
-/*MOKOTASKLIST property*/
-
-
-/*Pango Font spec*/
-
-#define MOKOTASKLIST_TYPE			(list_get_type())
-#define MOKOTASKLIST(obj)				(G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKOTASKLIST_TYPE, MokoTaskList))
-#define MOKOTASKLIST_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), MOKOTASKLIST_TYPE, MokoTaskListClass))
-#define IS_MOKOTASKLIST(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKOTASKLIST_TYPE))
-#define IS_MOKOTASKLIST_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), MOKOTASKLIST_TYPE))
-
-typedef struct _MokoTaskList		MokoTaskList;
-typedef struct _MokoTaskListClass	MokoTaskListClass;
-
-struct _MokoTaskList
-{
-	GtkVBox vbox;
-
-	GtkHBox *hbox;
-	GtkListStore *list_store;
-	GtkWidget *list_view;
-	GtkWidget *scrolled;
-};
-
-struct _MokoTaskListClass
-{
-	GtkVBoxClass parent_class;
-	void(*list) (MokoTaskList *l);
-};
-
-GType list_get_type (void);
-
-GtkWidget* 
-list_new();
-
-void 
-moko_update_store_list (Display *dpy, GtkListStore *list_store);
-
-void 
-moko_set_list_highlight (Display *dpy, MokoTaskList *l) ;
-
-G_END_DECLS
-
-#endif /*_MOKO_TASK_MANAGER_LIST_VIEW_H*/
+/**
+ *  list_view.h
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+ 
+#ifndef _MOKO_TASK_MANAGER_LIST_VIEW_H 
+#define _MOKO_TASK_MANAGER_LIST_VIEW_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <libmokoui/moko-tree-view.h>
+
+#include "misc.h"
+
+enum{
+    TEXT_COL = 0,
+    OBJECT_COL,
+    PIXBUF_COL,
+    MAX_COL
+};
+
+G_BEGIN_DECLS
+/*MOKOTASKLIST property*/
+
+
+/*Pango Font spec*/
+
+#define MOKOTASKLIST_TYPE			(list_get_type())
+#define MOKOTASKLIST(obj)				(G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKOTASKLIST_TYPE, MokoTaskList))
+#define MOKOTASKLIST_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), MOKOTASKLIST_TYPE, MokoTaskListClass))
+#define IS_MOKOTASKLIST(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKOTASKLIST_TYPE))
+#define IS_MOKOTASKLIST_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), MOKOTASKLIST_TYPE))
+
+typedef struct _MokoTaskList		MokoTaskList;
+typedef struct _MokoTaskListClass	MokoTaskListClass;
+
+struct _MokoTaskList
+{
+	GtkVBox vbox;
+
+	GtkHBox *hbox;
+	GtkListStore *list_store;
+	GtkWidget *list_view;
+	GtkWidget *scrolled;
+};
+
+struct _MokoTaskListClass
+{
+	GtkVBoxClass parent_class;
+	void(*list) (MokoTaskList *l);
+};
+
+GType list_get_type (void);
+
+GtkWidget* 
+list_new();
+
+void 
+moko_update_store_list (Display *dpy, GtkListStore *list_store);
+
+void 
+moko_set_list_highlight (Display *dpy, MokoTaskList *l) ;
+
+G_END_DECLS
+
+#endif /*_MOKO_TASK_MANAGER_LIST_VIEW_H*/

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,381 +1,381 @@
-/**
- *  misc.c
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include "misc.h"
-
-gboolean 
-moko_X_ev_init (Display *dpy, GtkWidget *gtkwidget) 
-{
-    if (my_win == None)
-    	  my_win = GDK_WINDOW_XWINDOW (gtkwidget);
-    if (!moko_initialize_X_atoms(dpy))
-    	  return FALSE;
-    return TRUE;
-}
-
-gboolean 
-moko_update_net_undocked_client_list(Display *dpy, Window** list, guint * nr) 
-{
-    Atom actual_type, type;
-    Window *temp_list;
-    int actual_format;
-    unsigned long nitems, bytes_after = 0;
-    unsigned char *prop = NULL;
-    int counter = 0, i = 0, rc;
-
-    moko_initialize_X_atoms(dpy);
-    
-    rc = XGetWindowProperty (dpy, DefaultRootWindow (dpy), atoms[_NET_CLIENT_LIST],
-    						0, G_MAXLONG, False, XA_WINDOW, &actual_type, &actual_format,
-						   &nitems, &bytes_after, &prop);
-    if (rc != Success || prop == NULL)
-    	  return FALSE;
-    //moko_print_win_list(dpy, prop, nitems);
-    temp_list = g_malloc0 (sizeof (Window) * nitems);
-    if (temp_list == NULL) 
-    {
-    	XFree (prop);
-    	return FALSE;
-    }
-    memcpy (temp_list, prop, sizeof (Window) * nitems);
-    XFree (prop);
-    
-    /*need to make clear thar whether the "Client List" is ordered by the 
-    atom "_NET_WM_WINDOW_TYPE", if it does, what we need to do will become 
-    more simple that only find the boundary of "dock" and "Undock" window in the list.
-    */
-    for (i=0; i<nitems; i++) 
-    {
-    	type = moko_get_window_property (dpy, temp_list[i], atoms[_NET_WM_WINDOW_TYPE]);
-		if (type == atoms[_NET_WM_WINDOW_TYPE_NORMAL])
-		{
-	    	temp_list[counter] = temp_list[i];
-	    	counter ++;
-		}
-    }
-    *nr = counter;
-    *list = g_malloc0 (sizeof (Window) * counter);
-    memcpy (*list, temp_list, sizeof (Window) * counter);
-    XFree (temp_list);
-    return TRUE;
-}
-
-gboolean 
-moko_iconify_client(Display* dpy, Window* w) 
-{
-    if (dpy == NULL || w == NULL)
-    	return FALSE;
-    else
-	{
-    	GdkScreen * screen = gdk_screen_get_default ();
-    	int i ;
-    	i = gdk_screen_get_number (screen);
-    	gdk_error_trap_push ();
-    	g_debug ("test XIconifyWindow");
-    	XIconifyWindow (dpy, w, 0);
-    	XFlush (dpy);
-    	if (gdk_error_trap_pop ())
-    		return FALSE;
-    	return TRUE;
-    }
-}
-
-GdkPixbuf *
-moko_get_window_icon (Display *dpy, Window w) 
-{
-    Atom actual_type;
-    int actual_format;
-    unsigned long nitems, bytes_after;
-    unsigned char *data = NULL;
-    int rc;
-    GdkPixbuf *pixbuf = NULL;
-    
-    gdk_error_trap_push ();
-    rc = XGetWindowProperty (dpy, w, atoms[_NET_WM_ICON],
-    		0, G_MAXLONG, False, XA_CARDINAL, &actual_type, &actual_format,
-    		&nitems, &bytes_after, &data);
-
-    if (gdk_error_trap_pop () || rc != Success)
-    	  return NULL;
-    if (nitems) 
-	{
-    	  guint *prop = (guint *)data;
-    	  guint w = prop[0], h = prop[1];
-    	  guint i;
-    	  guchar *pixels = g_malloc (w * h * 4);
-    	  guchar *p = pixels;
-    	  for (i = 0; i < w * h; i++) 
-		  {
-    		 gulong l = prop[2 + i];
-    		 *(p++) = (l & 0x00ff0000) >> 16;
-    		 *(p++) = (l & 0x0000ff00) >> 8;
-    		 *(p++) = (l & 0x000000ff);
-    		 *(p++) = (l & 0xff000000) >> 24;
-    	 }
-    	
-    	 pixbuf = gdk_pixbuf_new_from_data (pixels,
-					 GDK_COLORSPACE_RGB,
-					 TRUE,
-					 8,
-					 w, h,
-					 w * 4,
-					 (GdkPixbufDestroyNotify)g_free,
-					 NULL);
-    }
-    if (data)
-    	XFree (data);
-    return pixbuf;
-}
-
-gchar *
-moko_get_window_name (Display *dpy, Window w) 
-{
-    Atom actual_type;
-    int actual_format;
-    unsigned long nitems, bytes_after;
-    unsigned char *prop = NULL;
-    gchar *name = NULL;
-    int rc;
-
-    gdk_error_trap_push ();
-    rc = XGetWindowProperty (dpy, w, atoms[_NET_WM_NAME],
-    	0, G_MAXLONG, False, atoms[UTF8_STRING], &actual_type, &actual_format,
-    	&nitems, &bytes_after, &prop);
-    if (gdk_error_trap_pop () || rc != Success)
-    	return NULL;
-    if (nitems)
-	{
-    	name = g_strdup (prop);
-    	XFree (prop);
-    }
-    else
-	{
-    	gdk_error_trap_push ();
-    	rc = XGetWindowProperty (dpy, w, XA_WM_NAME,
-    		0, G_MAXLONG, False, XA_STRING, &actual_type, &actual_format,
-    		&nitems, &bytes_after, &prop);
-    	if (gdk_error_trap_pop () || rc != Success)
-    		return FALSE;
-    	if (nitems) 
-		{
-    		name = g_locale_to_utf8 (prop, -1, NULL, NULL, NULL);
-    		XFree (prop);
-    	}
-    }
-    return name;
-}
-
-
-void 
-moko_print_win_list (Display* dpy, Window* win_list, guint win_num) 
-{
-    int i;
-    char* winname = NULL;
-
-    if (win_num > 1) 
-    	g_debug ("****there are %d windows in total****", win_num);
-    
-    for (i=0; i<win_num; i++) 
-    {
-    	winname = moko_get_window_name(dpy, win_list[i]);
-    	g_debug ("%d. %s ", i, winname);
-    }
-}
-
-Atom
-moko_get_window_property (Display *dpy, Window w, Atom property) 
-{
-    Atom result = None;
-    Atom actual_type;
-    int actual_format;
-    unsigned long nitems, bytes_after;
-    unsigned char *prop = NULL;
-    int rc;
-    
-    gdk_error_trap_push ();
-    rc = XGetWindowProperty (dpy, w, property,
-    			0, 1, False, XA_ATOM, &actual_type, &actual_format,
-			  &nitems, &bytes_after, &prop);
-    if (gdk_error_trap_pop () || rc != Success)
-	{
-    	//g_debug ("Have not obtain the property");
-    	return None;
-    }
-    
-	if (prop) 
-	{
-    	memcpy (&result, prop, sizeof (result));
-    	XFree (prop);
-    }
-    return result;
-}
-
-guint
-moko_tab_event_check (Display *dpy) 
-{
-    XEvent ev;
-    guint done = 0;
-    Bool	clicked = FALSE;
-    struct timeval then, now;
-    Time click_time = 800;
-    Time final_time = 2*click_time;
-    
-    gettimeofday(&then, NULL);
-
-    //check the click type: tap "done = 1 "; tap with hold "done = 2";
-    while (!done) 
-	{
-    	if (XCheckMaskEvent(dpy, ButtonReleaseMask, &ev))
-    		if (ev.type == ButtonRelease) 
-    			done=1;
-    		gettimeofday(&now, NULL);
-    	if ((now.tv_usec-then.tv_usec)>(click_time*1000) || now.tv_sec > then.tv_sec)
-    		done=2;
-    }
-    return done;
-}
-
-
-gboolean 
-moko_get_current_active_client(Display *dpy, Window *window_return) 
-{
-    Atom actual_type, type;
-    unsigned char* prop = NULL;
-    int actual_format;
-    unsigned long nitems, bytes_after = 0;
-
-    if (XGetWindowProperty (dpy, DefaultRootWindow (dpy), atoms[_NET_ACTIVE_WINDOW],
-    			0, 4, False, XA_WINDOW, &type, &actual_format, &nitems, &bytes_after, (unsigned char **)&prop)
-    		== Success)
-	{
-    	*window_return = g_malloc0(sizeof (Window) * nitems);
-    	memcpy (*window_return, prop, sizeof (Window) * nitems);
-    	XFree (prop);
-    	return TRUE;
-    }
-    else return FALSE;
-}
-
-void
-mbcommand(Display *dpy, int cmd_id, Window win, char *data) 
-{
-    XEvent ev;
-    Window root;
-    Atom theme_prop, cmd_prop, desktop_manager_atom;
-
-    desktop_manager_atom = XInternAtom(dpy, "_NET_DESKTOP_MANGER",False);
-
-    root = DefaultRootWindow(dpy);
-
-    /*use to grab desktop later*/
-    if (cmd_id == MB_CMD_DESKTOP) {
-       /* Check if desktop is running */
-       if (!XGetSelectionOwner(dpy, desktop_manager_atom)) {
-	   fprintf(stderr, "Desktop not running, exiting...\n");
-	   switch (fork()) {
-	   	case 0:
-	           execvp ("mbdesktop", NULL);
-	           break;
-	       case -1:
-	           fprintf(stderr, "failed to exec mbdesktop");
-	           break;
-	       }
-	   exit(0);
-	   }
-       } 
-
-    if (cmd_id == MB_CMD_REMOVE_CLIENT)
-	{
-		if (moko_kill_window (dpy, win))
-			return;
-	}
-
-    cmd_prop = XInternAtom(dpy, "_MB_COMMAND", False);
-    memset(&ev, '\0', sizeof ev);
-    ev.xclient.type = ClientMessage;
-    if (win == NULL)
-    	ev.xclient.window = root; 	/* we send it _from_ root as we have no win  */
-    else
-    	ev.xclient.window = win;
-    ev.xclient.message_type = cmd_prop;
-    ev.xclient.format = 8;
-    ev.xclient.data.l[0] = cmd_id;
-    
-    XSendEvent(dpy, root, False, SubstructureRedirectMask|SubstructureNotifyMask, &ev);
-    XFlush (dpy);
-}
-
-static gboolean
-moko_send_delete_message (Display *dpy, Window w) 
-{
-    XEvent e;
-    
-    e.type = ClientMessage;
-    e.xclient.window = w;
-    e.xclient.message_type = atoms[WM_PROTOCOLS];
-    e.xclient.format = 32;
-    e.xclient.data.l[0] = atoms[WM_DELETE_WINDOW];
-    e.xclient.data.l[1] = CurrentTime;
-
-    gdk_error_trap_push ();
-    XSendEvent (dpy, w, False, NoEventMask, &e);
-    XFlush (dpy);
-    if (gdk_error_trap_pop ())
-    	return FALSE;
-    return TRUE;
-}
-
-static gboolean
-moko_really_kill_client (Display *dpy, Window w) 
-{
-    gdk_error_trap_push ();
-
-    XKillClient (dpy, w);
-    XFlush (dpy);
-    if (gdk_error_trap_pop ())
-    	return FALSE;
-    return TRUE;
-}
-
-gboolean
-moko_kill_window (Display *dpy, Window w)
-{
-    Atom *protocols;
-    int count, rc;
-
-    gdk_error_trap_push ();
-    rc = XGetWMProtocols (dpy, w, &protocols, &count);
-    if (gdk_error_trap_pop ())
-    	return FALSE;
-    if (rc)
-	{
-    	int i;
-    	gboolean delete_supported = FALSE;
-    	for (i = 0; i < count; i++) 
-		{
-    		if (protocols[i] == WM_DELETE_WINDOW)
-    			delete_supported = TRUE;
-    	}
-    	XFree (protocols);
-    	if (delete_supported)
-    		return moko_send_delete_message (dpy, w);
-   	}
-    return moko_really_kill_client (dpy, w);
-}
-
+/**
+ *  misc.c
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "misc.h"
+
+gboolean 
+moko_X_ev_init (Display *dpy, GtkWidget *gtkwidget) 
+{
+    if (my_win == None)
+    	  my_win = GDK_WINDOW_XWINDOW (gtkwidget);
+    if (!moko_initialize_X_atoms(dpy))
+    	  return FALSE;
+    return TRUE;
+}
+
+gboolean 
+moko_update_net_undocked_client_list(Display *dpy, Window** list, guint * nr) 
+{
+    Atom actual_type, type;
+    Window *temp_list;
+    int actual_format;
+    unsigned long nitems, bytes_after = 0;
+    unsigned char *prop = NULL;
+    int counter = 0, i = 0, rc;
+
+    moko_initialize_X_atoms(dpy);
+    
+    rc = XGetWindowProperty (dpy, DefaultRootWindow (dpy), atoms[_NET_CLIENT_LIST],
+    						0, G_MAXLONG, False, XA_WINDOW, &actual_type, &actual_format,
+						   &nitems, &bytes_after, &prop);
+    if (rc != Success || prop == NULL)
+    	  return FALSE;
+    //moko_print_win_list(dpy, prop, nitems);
+    temp_list = g_malloc0 (sizeof (Window) * nitems);
+    if (temp_list == NULL) 
+    {
+    	XFree (prop);
+    	return FALSE;
+    }
+    memcpy (temp_list, prop, sizeof (Window) * nitems);
+    XFree (prop);
+    
+    /*need to make clear thar whether the "Client List" is ordered by the 
+    atom "_NET_WM_WINDOW_TYPE", if it does, what we need to do will become 
+    more simple that only find the boundary of "dock" and "Undock" window in the list.
+    */
+    for (i=0; i<nitems; i++) 
+    {
+    	type = moko_get_window_property (dpy, temp_list[i], atoms[_NET_WM_WINDOW_TYPE]);
+		if (type == atoms[_NET_WM_WINDOW_TYPE_NORMAL])
+		{
+	    	temp_list[counter] = temp_list[i];
+	    	counter ++;
+		}
+    }
+    *nr = counter;
+    *list = g_malloc0 (sizeof (Window) * counter);
+    memcpy (*list, temp_list, sizeof (Window) * counter);
+    XFree (temp_list);
+    return TRUE;
+}
+
+gboolean 
+moko_iconify_client(Display* dpy, Window* w) 
+{
+    if (dpy == NULL || w == NULL)
+    	return FALSE;
+    else
+	{
+    	GdkScreen * screen = gdk_screen_get_default ();
+    	int i ;
+    	i = gdk_screen_get_number (screen);
+    	gdk_error_trap_push ();
+    	g_debug ("test XIconifyWindow");
+    	XIconifyWindow (dpy, w, 0);
+    	XFlush (dpy);
+    	if (gdk_error_trap_pop ())
+    		return FALSE;
+    	return TRUE;
+    }
+}
+
+GdkPixbuf *
+moko_get_window_icon (Display *dpy, Window w) 
+{
+    Atom actual_type;
+    int actual_format;
+    unsigned long nitems, bytes_after;
+    unsigned char *data = NULL;
+    int rc;
+    GdkPixbuf *pixbuf = NULL;
+    
+    gdk_error_trap_push ();
+    rc = XGetWindowProperty (dpy, w, atoms[_NET_WM_ICON],
+    		0, G_MAXLONG, False, XA_CARDINAL, &actual_type, &actual_format,
+    		&nitems, &bytes_after, &data);
+
+    if (gdk_error_trap_pop () || rc != Success)
+    	  return NULL;
+    if (nitems) 
+	{
+    	  guint *prop = (guint *)data;
+    	  guint w = prop[0], h = prop[1];
+    	  guint i;
+    	  guchar *pixels = g_malloc (w * h * 4);
+    	  guchar *p = pixels;
+    	  for (i = 0; i < w * h; i++) 
+		  {
+    		 gulong l = prop[2 + i];
+    		 *(p++) = (l & 0x00ff0000) >> 16;
+    		 *(p++) = (l & 0x0000ff00) >> 8;
+    		 *(p++) = (l & 0x000000ff);
+    		 *(p++) = (l & 0xff000000) >> 24;
+    	 }
+    	
+    	 pixbuf = gdk_pixbuf_new_from_data (pixels,
+					 GDK_COLORSPACE_RGB,
+					 TRUE,
+					 8,
+					 w, h,
+					 w * 4,
+					 (GdkPixbufDestroyNotify)g_free,
+					 NULL);
+    }
+    if (data)
+    	XFree (data);
+    return pixbuf;
+}
+
+gchar *
+moko_get_window_name (Display *dpy, Window w) 
+{
+    Atom actual_type;
+    int actual_format;
+    unsigned long nitems, bytes_after;
+    unsigned char *prop = NULL;
+    gchar *name = NULL;
+    int rc;
+
+    gdk_error_trap_push ();
+    rc = XGetWindowProperty (dpy, w, atoms[_NET_WM_NAME],
+    	0, G_MAXLONG, False, atoms[UTF8_STRING], &actual_type, &actual_format,
+    	&nitems, &bytes_after, &prop);
+    if (gdk_error_trap_pop () || rc != Success)
+    	return NULL;
+    if (nitems)
+	{
+    	name = g_strdup (prop);
+    	XFree (prop);
+    }
+    else
+	{
+    	gdk_error_trap_push ();
+    	rc = XGetWindowProperty (dpy, w, XA_WM_NAME,
+    		0, G_MAXLONG, False, XA_STRING, &actual_type, &actual_format,
+    		&nitems, &bytes_after, &prop);
+    	if (gdk_error_trap_pop () || rc != Success)
+    		return FALSE;
+    	if (nitems) 
+		{
+    		name = g_locale_to_utf8 (prop, -1, NULL, NULL, NULL);
+    		XFree (prop);
+    	}
+    }
+    return name;
+}
+
+
+void 
+moko_print_win_list (Display* dpy, Window* win_list, guint win_num) 
+{
+    int i;
+    char* winname = NULL;
+
+    if (win_num > 1) 
+    	g_debug ("****there are %d windows in total****", win_num);
+    
+    for (i=0; i<win_num; i++) 
+    {
+    	winname = moko_get_window_name(dpy, win_list[i]);
+    	g_debug ("%d. %s ", i, winname);
+    }
+}
+
+Atom
+moko_get_window_property (Display *dpy, Window w, Atom property) 
+{
+    Atom result = None;
+    Atom actual_type;
+    int actual_format;
+    unsigned long nitems, bytes_after;
+    unsigned char *prop = NULL;
+    int rc;
+    
+    gdk_error_trap_push ();
+    rc = XGetWindowProperty (dpy, w, property,
+    			0, 1, False, XA_ATOM, &actual_type, &actual_format,
+			  &nitems, &bytes_after, &prop);
+    if (gdk_error_trap_pop () || rc != Success)
+	{
+    	//g_debug ("Have not obtain the property");
+    	return None;
+    }
+    
+	if (prop) 
+	{
+    	memcpy (&result, prop, sizeof (result));
+    	XFree (prop);
+    }
+    return result;
+}
+
+guint
+moko_tab_event_check (Display *dpy) 
+{
+    XEvent ev;
+    guint done = 0;
+    Bool	clicked = FALSE;
+    struct timeval then, now;
+    Time click_time = 800;
+    Time final_time = 2*click_time;
+    
+    gettimeofday(&then, NULL);
+
+    //check the click type: tap "done = 1 "; tap with hold "done = 2";
+    while (!done) 
+	{
+    	if (XCheckMaskEvent(dpy, ButtonReleaseMask, &ev))
+    		if (ev.type == ButtonRelease) 
+    			done=1;
+    		gettimeofday(&now, NULL);
+    	if ((now.tv_usec-then.tv_usec)>(click_time*1000) || now.tv_sec > then.tv_sec)
+    		done=2;
+    }
+    return done;
+}
+
+
+gboolean 
+moko_get_current_active_client(Display *dpy, Window *window_return) 
+{
+    Atom actual_type, type;
+    unsigned char* prop = NULL;
+    int actual_format;
+    unsigned long nitems, bytes_after = 0;
+
+    if (XGetWindowProperty (dpy, DefaultRootWindow (dpy), atoms[_NET_ACTIVE_WINDOW],
+    			0, 4, False, XA_WINDOW, &type, &actual_format, &nitems, &bytes_after, (unsigned char **)&prop)
+    		== Success)
+	{
+    	*window_return = g_malloc0(sizeof (Window) * nitems);
+    	memcpy (*window_return, prop, sizeof (Window) * nitems);
+    	XFree (prop);
+    	return TRUE;
+    }
+    else return FALSE;
+}
+
+void
+mbcommand(Display *dpy, int cmd_id, Window win, char *data) 
+{
+    XEvent ev;
+    Window root;
+    Atom theme_prop, cmd_prop, desktop_manager_atom;
+
+    desktop_manager_atom = XInternAtom(dpy, "_NET_DESKTOP_MANGER",False);
+
+    root = DefaultRootWindow(dpy);
+
+    /*use to grab desktop later*/
+    if (cmd_id == MB_CMD_DESKTOP) {
+       /* Check if desktop is running */
+       if (!XGetSelectionOwner(dpy, desktop_manager_atom)) {
+	   fprintf(stderr, "Desktop not running, exiting...\n");
+	   switch (fork()) {
+	   	case 0:
+	           execvp ("mbdesktop", NULL);
+	           break;
+	       case -1:
+	           fprintf(stderr, "failed to exec mbdesktop");
+	           break;
+	       }
+	   exit(0);
+	   }
+       } 
+
+    if (cmd_id == MB_CMD_REMOVE_CLIENT)
+	{
+		if (moko_kill_window (dpy, win))
+			return;
+	}
+
+    cmd_prop = XInternAtom(dpy, "_MB_COMMAND", False);
+    memset(&ev, '\0', sizeof ev);
+    ev.xclient.type = ClientMessage;
+    if (win == NULL)
+    	ev.xclient.window = root; 	/* we send it _from_ root as we have no win  */
+    else
+    	ev.xclient.window = win;
+    ev.xclient.message_type = cmd_prop;
+    ev.xclient.format = 8;
+    ev.xclient.data.l[0] = cmd_id;
+    
+    XSendEvent(dpy, root, False, SubstructureRedirectMask|SubstructureNotifyMask, &ev);
+    XFlush (dpy);
+}
+
+static gboolean
+moko_send_delete_message (Display *dpy, Window w) 
+{
+    XEvent e;
+    
+    e.type = ClientMessage;
+    e.xclient.window = w;
+    e.xclient.message_type = atoms[WM_PROTOCOLS];
+    e.xclient.format = 32;
+    e.xclient.data.l[0] = atoms[WM_DELETE_WINDOW];
+    e.xclient.data.l[1] = CurrentTime;
+
+    gdk_error_trap_push ();
+    XSendEvent (dpy, w, False, NoEventMask, &e);
+    XFlush (dpy);
+    if (gdk_error_trap_pop ())
+    	return FALSE;
+    return TRUE;
+}
+
+static gboolean
+moko_really_kill_client (Display *dpy, Window w) 
+{
+    gdk_error_trap_push ();
+
+    XKillClient (dpy, w);
+    XFlush (dpy);
+    if (gdk_error_trap_pop ())
+    	return FALSE;
+    return TRUE;
+}
+
+gboolean
+moko_kill_window (Display *dpy, Window w)
+{
+    Atom *protocols;
+    int count, rc;
+
+    gdk_error_trap_push ();
+    rc = XGetWMProtocols (dpy, w, &protocols, &count);
+    if (gdk_error_trap_pop ())
+    	return FALSE;
+    if (rc)
+	{
+    	int i;
+    	gboolean delete_supported = FALSE;
+    	for (i = 0; i < count; i++) 
+		{
+    		if (protocols[i] == WM_DELETE_WINDOW)
+    			delete_supported = TRUE;
+    	}
+    	XFree (protocols);
+    	if (delete_supported)
+    		return moko_send_delete_message (dpy, w);
+   	}
+    return moko_really_kill_client (dpy, w);
+}
+

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,90 +1,90 @@
-/**
- *  misc.h
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _MOKO_TASK_MANAGER_MISC_H
-#define _MOKO_TASK_MANAGER_MISC_H
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <libintl.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xmd.h>
-
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-
-#include "xatoms.h"
-
-/*Matchbox windows manager structs*/
-#define MB_CMD_SET_THEME     1
-#define MB_CMD_EXIT          2
-#define MB_CMD_DESKTOP       3
-#define MB_CMD_NEXT          4
-#define MB_CMD_PREV          5
-#define MB_CMD_SHOW_EXT_MENU 6
-#define MB_CMD_MISC          7
-#define MB_CMD_COMPOSITE     8
-#define MB_CMB_KEYS_RELOAD   9
-
-#define MB_CMD_ACTIVATE_CLIENT 100
-#define MB_CMD_REMOVE_CLIENT 101
-#define MB_CMD_REMOVE_AND_ACTIVE 102
-
-Window my_win;
-
-
-gboolean 
-moko_X_ev_init (Display *dpy,GtkWidget *gtkwidget);
-
-gboolean 
-moko_update_net_undocked_client_list (Display* dpy, Window** list, guint* nr);
-
-GdkPixbuf *
-moko_get_window_icon (Display *dpy, Window w);
-
-gchar *
-moko_get_window_name (Display *dpy, Window w);
-
-void 
-moko_print_win_list (Display* dpy, Window* win_list, guint win_num);
-
-Atom
-moko_get_window_property (Display *dpy, Window w, Atom property);
-
-gboolean 
-moko_get_current_active_client (Display* dpy, Window* window_return);
-
-void
-mbcommand(Display *dpy, int cmd_id, Window win, char *data);
-
-gboolean 
-moko_active_next_client (Display* dpy);
-
-
-
-/********/
-gboolean 
-moko_set_atoms_name(const char** src_name, int src_num);
-
-
-#endif /*_MOKO_TASK_MANAGER_MISC_H*/
+/**
+ *  misc.h
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _MOKO_TASK_MANAGER_MISC_H
+#define _MOKO_TASK_MANAGER_MISC_H
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <libintl.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xmd.h>
+
+#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+
+#include "xatoms.h"
+
+/*Matchbox windows manager structs*/
+#define MB_CMD_SET_THEME     1
+#define MB_CMD_EXIT          2
+#define MB_CMD_DESKTOP       3
+#define MB_CMD_NEXT          4
+#define MB_CMD_PREV          5
+#define MB_CMD_SHOW_EXT_MENU 6
+#define MB_CMD_MISC          7
+#define MB_CMD_COMPOSITE     8
+#define MB_CMB_KEYS_RELOAD   9
+
+#define MB_CMD_ACTIVATE_CLIENT 100
+#define MB_CMD_REMOVE_CLIENT 101
+#define MB_CMD_REMOVE_AND_ACTIVE 102
+
+Window my_win;
+
+
+gboolean 
+moko_X_ev_init (Display *dpy,GtkWidget *gtkwidget);
+
+gboolean 
+moko_update_net_undocked_client_list (Display* dpy, Window** list, guint* nr);
+
+GdkPixbuf *
+moko_get_window_icon (Display *dpy, Window w);
+
+gchar *
+moko_get_window_name (Display *dpy, Window w);
+
+void 
+moko_print_win_list (Display* dpy, Window* win_list, guint win_num);
+
+Atom
+moko_get_window_property (Display *dpy, Window w, Atom property);
+
+gboolean 
+moko_get_current_active_client (Display* dpy, Window* window_return);
+
+void
+mbcommand(Display *dpy, int cmd_id, Window win, char *data);
+
+gboolean 
+moko_active_next_client (Display* dpy);
+
+
+
+/********/
+gboolean 
+moko_set_atoms_name(const char** src_name, int src_num);
+
+
+#endif /*_MOKO_TASK_MANAGER_MISC_H*/

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,66 +1,66 @@
-/**
- *  popupmenu.c
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include "popupmenu.h"
-
-void
-moko_kill_task_cb(GtkMenuItem *item, MokoTaskList *l) {
-    g_debug ("kill task cb");
-    //moko_wm_cmd(item, l->mokolist_view, MB_CMD_REMOVE_CLIENT);
-    moko_wm_cmd(item, l->list_view, MB_CMD_REMOVE_CLIENT);
-    }
-
-void 
-moko_kill_and_swith_cb(GtkMenuItem *item, MokoTaskList *l) {
-    g_debug ("call kill and switch task function");
-    //moko_wm_cmd(item, l->mokolist_view, MB_CMD_REMOVE_AND_ACTIVE);
-    moko_wm_cmd(item, l->list_view, MB_CMD_REMOVE_AND_ACTIVE);
-    }
-
-void
-moko_init_popup_menu (GtkWidget *my_widget, GdkEventButton *event, MokoTaskList *l) {
-    GtkWidget *menu;
-    GtkMenuItem *item;
-    int button, event_time;
-    
-    menu = gtk_menu_new ();
-    gtk_widget_show (menu);
-    g_signal_connect (menu, "selection-done", G_CALLBACK (gtk_widget_destroy), NULL);
-
-    /* ... add menu items ... */
-    item = gtk_menu_item_new_with_label ("Close and switch");
-    gtk_widget_show (item);
-    gtk_menu_prepend (menu, item);
-    g_signal_connect (item, "activate", G_CALLBACK (moko_kill_and_swith_cb), l);
-    item = gtk_menu_item_new_with_label ("Kill the Application");
-    gtk_widget_show (item);
-    gtk_menu_prepend (menu, item);
-    g_signal_connect (item, "activate", G_CALLBACK (moko_kill_task_cb), l);
-    if (event) {
-        button = event->button;
-        event_time = event->time;
-        }
-    else {
-    	 button = 0;
-    	 event_time = gtk_get_current_event_time ();
-    	 }
-    gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 
-    	 				button, event_time);
-    }
-
+/**
+ *  popupmenu.c
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "popupmenu.h"
+
+void
+moko_kill_task_cb(GtkMenuItem *item, MokoTaskList *l) {
+    g_debug ("kill task cb");
+    //moko_wm_cmd(item, l->mokolist_view, MB_CMD_REMOVE_CLIENT);
+    moko_wm_cmd(item, l->list_view, MB_CMD_REMOVE_CLIENT);
+    }
+
+void 
+moko_kill_and_swith_cb(GtkMenuItem *item, MokoTaskList *l) {
+    g_debug ("call kill and switch task function");
+    //moko_wm_cmd(item, l->mokolist_view, MB_CMD_REMOVE_AND_ACTIVE);
+    moko_wm_cmd(item, l->list_view, MB_CMD_REMOVE_AND_ACTIVE);
+    }
+
+void
+moko_init_popup_menu (GtkWidget *my_widget, GdkEventButton *event, MokoTaskList *l) {
+    GtkWidget *menu;
+    GtkMenuItem *item;
+    int button, event_time;
+    
+    menu = gtk_menu_new ();
+    gtk_widget_show (menu);
+    g_signal_connect (menu, "selection-done", G_CALLBACK (gtk_widget_destroy), NULL);
+
+    /* ... add menu items ... */
+    item = gtk_menu_item_new_with_label ("Close and switch");
+    gtk_widget_show (item);
+    gtk_menu_prepend (menu, item);
+    g_signal_connect (item, "activate", G_CALLBACK (moko_kill_and_swith_cb), l);
+    item = gtk_menu_item_new_with_label ("Kill the Application");
+    gtk_widget_show (item);
+    gtk_menu_prepend (menu, item);
+    g_signal_connect (item, "activate", G_CALLBACK (moko_kill_task_cb), l);
+    if (event) {
+        button = event->button;
+        event_time = event->time;
+        }
+    else {
+    	 button = 0;
+    	 event_time = gtk_get_current_event_time ();
+    	 }
+    gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 
+    	 				button, event_time);
+    }
+

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,33 +1,33 @@
-/**
- *  popupmenu.h
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _TASK_MANAGER_POPUP_MENU_H
-#define _TASK_MANAGER_POPUP_MENU_H
-
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-#include "list_view.h"
-#include "misc.h"
-
-void
-moko_init_popup_menu (GtkWidget *my_widget, GdkEventButton *event, MokoTaskList *l);
-
-
-#endif
+/**
+ *  popupmenu.h
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _TASK_MANAGER_POPUP_MENU_H
+#define _TASK_MANAGER_POPUP_MENU_H
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+#include "list_view.h"
+#include "misc.h"
+
+void
+moko_init_popup_menu (GtkWidget *my_widget, GdkEventButton *event, MokoTaskList *l);
+
+
+#endif

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,260 +1,260 @@
-/**
- *  taskmanager.c
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include "taskmanager.h"
-
-#include <stdio.h> 
-#include <X11/Xlib.h> 
-#include <X11/Xatom.h> 
-#include <glib.h> 
-#include <gtk/gtk.h> 
-#include <gdk/gdk.h> 
-#include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-
-#include "callbacks.h"
-
-#define OPAQUE  0x55555555
-/* set the widget's transparency to opacity 
- * opacity is guint 0x00000000-0xffffffff 
- */ 
-#define LOCK_FILE "/tmp/moko-taskmanager.lock"
-
-static MokoTaskManager *tm;
-
-static void 
-handle_sigusr1 (int value)
-{
-  if (!tm)
-       return;
-
-  gtk_widget_show_all (GTK_WIDGET (tm->window));
-  gtk_window_present (GTK_WIDGET (tm->window));
-  gtk_widget_show (GTK_WIDGET (tm->wheel));
-  gtk_widget_show (GTK_WIDGET (tm->toolbox));
-
-  signal (SIGUSR1, handle_sigusr1);
-  return;
-}
-
-static pid_t 
-testlock (char *fname)
-{
-  int fd;
-  struct flock fl;
-
-  fd = open (fname, O_WRONLY, S_IWUSR);
-  if (fd < 0)
-    {
-      if (errno == ENOENT)
-        {
-          return 0;
-        }
-      else
-        {
-          perror ("Test lock open file");
-          return -1;
-        }
-    }
-
-  fl.l_type = F_WRLCK;
-  fl.l_whence = SEEK_SET;
-  fl.l_start = 0;
-  fl.l_len = 0;
-
-  if (fcntl (fd, F_GETLK, &fl) < 0)
-    {
-      close (fd);
-      return -1;
-    }
-  close (fd);
-
-  if (fl.l_type == F_UNLCK)
-    return 0;
-
-  return fl.l_pid;
-}
-
-static void 
-setlock (char *fname)
-{
-  int fd;
-  struct flock fl;
-
-  fd = open (fname, O_WRONLY|O_CREAT, S_IWUSR);
-  if (fd < 0)
-    {
-      perror ("Set lock open file");
-      return ;
-    }
-
-  fl.l_type = F_WRLCK;
-  fl.l_whence = SEEK_SET;
-  fl.l_start = 0;
-  fl.l_len = 0;
-
-  if (fcntl (fd, F_SETLK, &fl) < 0)
-    {
-      perror ("Lock file");
-      close (fd);
-    }
-}
-
-int 
-gtk_widget_set_transparency(GtkWidget *widget, guint opacity) 
-{ 
-   Display *display; 
-   Window window; 
-   Window parent_win; 
-   Window root_win; 
-   Window* child_windows; 
-   int num_child_windows; 
-
-   if(!GTK_IS_WIDGET(widget)){ 
-                printf("gtk_widget_set_transparency: not a widget!\n"); 
-                return -1; 
-   } 
-
-   if(widget->window == NULL){ 
-                printf("gtk_widget_set_transparency: please init widget before set transparency!\n"); 
-                return -1; 
-   } 
-
-   /* Set the Display and Screen */ 
-   display = (Display*)gdk_x11_get_default_xdisplay(); 
-   /* sync, so the window manager can know the new widget */ 
-   XSync(display, False); 
-   window = GDK_WINDOW_XWINDOW(widget->window); 
-
-   /* Get the cureent window's top-level window */ 
-   while(1){ 
-        XQueryTree(display, window, 
-                            &root_win, 
-                            &parent_win, 
-                            &child_windows, &num_child_windows); 
-         XFree(child_windows); 
-       /* found the top-level window */ 
-          if(root_win == parent_win) break; 
-          window = parent_win; 
-   } 
-
-   if(opacity == OPAQUE){ 
-           XDeleteProperty(display, window, 
-                                   XInternAtom(display, "_NET_WM_WINDOW_OPACITY", False)); 
-   }
-   else{ 
-           XChangeProperty(display, window, 
-                                XInternAtom(display, "_NET_WM_WINDOW_OPACITY", False), 
-                                XA_CARDINAL, 32, PropModeReplace, 
-                                (unsigned char *) &opacity, 1L); 
-   } 
-
-   XSync(display, False); 
-
-   return 0; 
-} 
-
-int 
-main (int argc, char** argv)
-{
-    Display *dpy;
-    GtkWidget *image;
-    pid_t lockapp;
-
-    lockapp = testlock (LOCK_FILE);
-    if (lockapp > 0)
-     {
-        kill (lockapp, SIGUSR1);
-        return 0;
-     }
-    setlock (LOCK_FILE);
-
-    tm = g_malloc (sizeof (MokoTaskManager));
-    memset (tm, 0, sizeof (MokoTaskManager));
-	
-    gtk_init (&argc, &argv);
-    dpy = GDK_DISPLAY ();
-
-    tm->app = MOKO_APPLICATION(moko_application_get_instance());
-    g_set_application_name( "Openmoko-taskmanager" );
-    
-    /* finger based window */
-    tm->window = MOKO_FINGER_WINDOW(moko_finger_window_new());
-//    gtk_window_set_decorated (mma->window, FALSE);
-    gtk_widget_show (GTK_WIDGET (tm->window));
-
-    /* finger wheel object*/
-    tm->wheel = moko_finger_window_get_wheel (tm->window);
-
-    /* finger toolbox object*/
-    tm->toolbox = moko_finger_window_get_toolbox (tm->window);
-
-    tm->go_to =  moko_finger_tool_box_add_button_without_label (tm->toolbox);   
-    image = gtk_image_new_from_file (PKGDATADIR"/active_task.png");
-    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->go_to, image);
-    tm->kill =   moko_finger_tool_box_add_button_without_label (tm->toolbox);
-    image = gtk_image_new_from_file (PKGDATADIR"/close.png");
-    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->kill, image);
-    tm->kill_all = moko_finger_tool_box_add_button_without_label (tm->toolbox);
-    image = gtk_image_new_from_file (PKGDATADIR"/close_all.png");
-    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->kill_all, image);
-    tm->quit =  moko_finger_tool_box_add_button_without_label (tm->toolbox);
-    image = gtk_image_new_from_file (PKGDATADIR"/exit.png");
-    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->quit, image);
-
-    tm->l = moko_task_list_new();
-    moko_update_store_list(dpy, tm->l->list_store);
-    //moko_set_list_highlight(dpy, tm->l);
-    gtk_widget_show (GTK_WIDGET (tm->l));
-	
-    moko_finger_window_set_contents (tm->window, GTK_WIDGET(tm->l));
-
-    g_signal_connect (tm->go_to, "clicked", 
-    			G_CALLBACK (moko_go_to_btn_cb), tm);
-    g_signal_connect (tm->kill, "clicked", 
-    			G_CALLBACK (moko_kill_btn_cb), tm);
-    g_signal_connect (tm->kill_all, "clicked", 
-    			G_CALLBACK (moko_kill_all_btn_cb), tm);
-    g_signal_connect (tm->quit, "clicked", 
-    			G_CALLBACK (moko_quit_btn_cb), tm);
-    g_signal_connect (tm->wheel, "press_left_up",
-    			G_CALLBACK 	(moko_wheel_left_up_press_cb), tm);
-    g_signal_connect (tm->wheel, "press_right_down",
-    			G_CALLBACK (moko_wheel_right_down_press_cb), tm);
-
-    gdk_window_add_filter (NULL, moko_window_filter, tm->l);
-    XSelectInput (dpy, DefaultRootWindow (dpy), PropertyChangeMask);
-
-    signal (SIGUSR1, handle_sigusr1);
-
-    //gtk_widget_set_transparency(tm->window, 50);
-
-    gtk_widget_show_all (GTK_WIDGET (tm->window));
-    gtk_widget_show (GTK_WIDGET (tm->wheel));
-    gtk_widget_show (GTK_WIDGET (tm->toolbox));
-
-    gtk_main();
-
-    if (tm)
-        g_free (tm);
-}
+/**
+ *  taskmanager.c
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "taskmanager.h"
+
+#include <stdio.h> 
+#include <X11/Xlib.h> 
+#include <X11/Xatom.h> 
+#include <glib.h> 
+#include <gtk/gtk.h> 
+#include <gdk/gdk.h> 
+#include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+
+#include "callbacks.h"
+
+#define OPAQUE  0x55555555
+/* set the widget's transparency to opacity 
+ * opacity is guint 0x00000000-0xffffffff 
+ */ 
+#define LOCK_FILE "/tmp/moko-taskmanager.lock"
+
+static MokoTaskManager *tm;
+
+static void 
+handle_sigusr1 (int value)
+{
+  if (!tm)
+       return;
+
+  gtk_widget_show_all (GTK_WIDGET (tm->window));
+  gtk_window_present (GTK_WIDGET (tm->window));
+  gtk_widget_show (GTK_WIDGET (tm->wheel));
+  gtk_widget_show (GTK_WIDGET (tm->toolbox));
+
+  signal (SIGUSR1, handle_sigusr1);
+  return;
+}
+
+static pid_t 
+testlock (char *fname)
+{
+  int fd;
+  struct flock fl;
+
+  fd = open (fname, O_WRONLY, S_IWUSR);
+  if (fd < 0)
+    {
+      if (errno == ENOENT)
+        {
+          return 0;
+        }
+      else
+        {
+          perror ("Test lock open file");
+          return -1;
+        }
+    }
+
+  fl.l_type = F_WRLCK;
+  fl.l_whence = SEEK_SET;
+  fl.l_start = 0;
+  fl.l_len = 0;
+
+  if (fcntl (fd, F_GETLK, &fl) < 0)
+    {
+      close (fd);
+      return -1;
+    }
+  close (fd);
+
+  if (fl.l_type == F_UNLCK)
+    return 0;
+
+  return fl.l_pid;
+}
+
+static void 
+setlock (char *fname)
+{
+  int fd;
+  struct flock fl;
+
+  fd = open (fname, O_WRONLY|O_CREAT, S_IWUSR);
+  if (fd < 0)
+    {
+      perror ("Set lock open file");
+      return ;
+    }
+
+  fl.l_type = F_WRLCK;
+  fl.l_whence = SEEK_SET;
+  fl.l_start = 0;
+  fl.l_len = 0;
+
+  if (fcntl (fd, F_SETLK, &fl) < 0)
+    {
+      perror ("Lock file");
+      close (fd);
+    }
+}
+
+int 
+gtk_widget_set_transparency(GtkWidget *widget, guint opacity) 
+{ 
+   Display *display; 
+   Window window; 
+   Window parent_win; 
+   Window root_win; 
+   Window* child_windows; 
+   int num_child_windows; 
+
+   if(!GTK_IS_WIDGET(widget)){ 
+                printf("gtk_widget_set_transparency: not a widget!\n"); 
+                return -1; 
+   } 
+
+   if(widget->window == NULL){ 
+                printf("gtk_widget_set_transparency: please init widget before set transparency!\n"); 
+                return -1; 
+   } 
+
+   /* Set the Display and Screen */ 
+   display = (Display*)gdk_x11_get_default_xdisplay(); 
+   /* sync, so the window manager can know the new widget */ 
+   XSync(display, False); 
+   window = GDK_WINDOW_XWINDOW(widget->window); 
+
+   /* Get the cureent window's top-level window */ 
+   while(1){ 
+        XQueryTree(display, window, 
+                            &root_win, 
+                            &parent_win, 
+                            &child_windows, &num_child_windows); 
+         XFree(child_windows); 
+       /* found the top-level window */ 
+          if(root_win == parent_win) break; 
+          window = parent_win; 
+   } 
+
+   if(opacity == OPAQUE){ 
+           XDeleteProperty(display, window, 
+                                   XInternAtom(display, "_NET_WM_WINDOW_OPACITY", False)); 
+   }
+   else{ 
+           XChangeProperty(display, window, 
+                                XInternAtom(display, "_NET_WM_WINDOW_OPACITY", False), 
+                                XA_CARDINAL, 32, PropModeReplace, 
+                                (unsigned char *) &opacity, 1L); 
+   } 
+
+   XSync(display, False); 
+
+   return 0; 
+} 
+
+int 
+main (int argc, char** argv)
+{
+    Display *dpy;
+    GtkWidget *image;
+    pid_t lockapp;
+
+    lockapp = testlock (LOCK_FILE);
+    if (lockapp > 0)
+     {
+        kill (lockapp, SIGUSR1);
+        return 0;
+     }
+    setlock (LOCK_FILE);
+
+    tm = g_malloc (sizeof (MokoTaskManager));
+    memset (tm, 0, sizeof (MokoTaskManager));
+	
+    gtk_init (&argc, &argv);
+    dpy = GDK_DISPLAY ();
+
+    tm->app = MOKO_APPLICATION(moko_application_get_instance());
+    g_set_application_name( "Openmoko-taskmanager" );
+    
+    /* finger based window */
+    tm->window = MOKO_FINGER_WINDOW(moko_finger_window_new());
+//    gtk_window_set_decorated (mma->window, FALSE);
+    gtk_widget_show (GTK_WIDGET (tm->window));
+
+    /* finger wheel object*/
+    tm->wheel = moko_finger_window_get_wheel (tm->window);
+
+    /* finger toolbox object*/
+    tm->toolbox = moko_finger_window_get_toolbox (tm->window);
+
+    tm->go_to =  moko_finger_tool_box_add_button_without_label (tm->toolbox);   
+    image = gtk_image_new_from_file (PKGDATADIR"/active_task.png");
+    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->go_to, image);
+    tm->kill =   moko_finger_tool_box_add_button_without_label (tm->toolbox);
+    image = gtk_image_new_from_file (PKGDATADIR"/close.png");
+    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->kill, image);
+    tm->kill_all = moko_finger_tool_box_add_button_without_label (tm->toolbox);
+    image = gtk_image_new_from_file (PKGDATADIR"/close_all.png");
+    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->kill_all, image);
+    tm->quit =  moko_finger_tool_box_add_button_without_label (tm->toolbox);
+    image = gtk_image_new_from_file (PKGDATADIR"/exit.png");
+    moko_pixmap_button_set_finger_toolbox_btn_center_image (tm->quit, image);
+
+    tm->l = moko_task_list_new();
+    moko_update_store_list(dpy, tm->l->list_store);
+    //moko_set_list_highlight(dpy, tm->l);
+    gtk_widget_show (GTK_WIDGET (tm->l));
+	
+    moko_finger_window_set_contents (tm->window, GTK_WIDGET(tm->l));
+
+    g_signal_connect (tm->go_to, "clicked", 
+    			G_CALLBACK (moko_go_to_btn_cb), tm);
+    g_signal_connect (tm->kill, "clicked", 
+    			G_CALLBACK (moko_kill_btn_cb), tm);
+    g_signal_connect (tm->kill_all, "clicked", 
+    			G_CALLBACK (moko_kill_all_btn_cb), tm);
+    g_signal_connect (tm->quit, "clicked", 
+    			G_CALLBACK (moko_quit_btn_cb), tm);
+    g_signal_connect (tm->wheel, "press_left_up",
+    			G_CALLBACK 	(moko_wheel_left_up_press_cb), tm);
+    g_signal_connect (tm->wheel, "press_right_down",
+    			G_CALLBACK (moko_wheel_right_down_press_cb), tm);
+
+    gdk_window_add_filter (NULL, moko_window_filter, tm->l);
+    XSelectInput (dpy, DefaultRootWindow (dpy), PropertyChangeMask);
+
+    signal (SIGUSR1, handle_sigusr1);
+
+    //gtk_widget_set_transparency(tm->window, 50);
+
+    gtk_widget_show_all (GTK_WIDGET (tm->window));
+    gtk_widget_show (GTK_WIDGET (tm->wheel));
+    gtk_widget_show (GTK_WIDGET (tm->toolbox));
+
+    gtk_main();
+
+    if (tm)
+        g_free (tm);
+}

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,65 +1,65 @@
-/**
- *  taskmanager.h
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _TASK_MANAGER_H
-#define _TASK_MANAGER_H
-
-#include <libmokoui/moko-application.h>
-#include <libmokoui/moko-finger-tool-box.h>
-#include <libmokoui/moko-finger-window.h>
-#include <libmokoui/moko-finger-wheel.h>
-#include <libmokoui/moko-pixmap-button.h>
-
-
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <X11/Xlib.h>
-
-#include "list_view.h"
-
-//#ifndef GTK_STOCK_CLOSE
-//#define GTK_STOCK_CLOSE "button_colse"
-//#endif
-
-#define TASK_MANAGER_PROPERTY_WIDTH		200
-#define TASK_MANAGER_PROPERTY_HEIGHT	564 
-#define TASK_MANAGER_PROPERTY_X		0
-#define TASK_MANAGER_PROPERTY_Y 		45 
-
-#define _(string) (string)
-
-typedef struct _MokoTaskManager MokoTaskManager;
-
-struct _MokoTaskManager {
-    MokoApplication *app;
-    
-    MokoFingerWindow *window;//??
-    GtkWidget *gtk_window;//??
-    MokoFingerWheel *wheel;
-    MokoFingerToolBox *toolbox;
-    MokoTaskList *l;
-    
-    MokoPixmapButton *go_to;
-    MokoPixmapButton *kill;
-    MokoPixmapButton *kill_all;
-    MokoPixmapButton *quit;
-
-    };
- 
-#endif /*taskmanager.h*/
+/**
+ *  taskmanager.h
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _TASK_MANAGER_H
+#define _TASK_MANAGER_H
+
+#include <libmokoui/moko-application.h>
+#include <libmokoui/moko-finger-tool-box.h>
+#include <libmokoui/moko-finger-window.h>
+#include <libmokoui/moko-finger-wheel.h>
+#include <libmokoui/moko-pixmap-button.h>
+
+
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <X11/Xlib.h>
+
+#include "list_view.h"
+
+//#ifndef GTK_STOCK_CLOSE
+//#define GTK_STOCK_CLOSE "button_colse"
+//#endif
+
+#define TASK_MANAGER_PROPERTY_WIDTH		200
+#define TASK_MANAGER_PROPERTY_HEIGHT	564 
+#define TASK_MANAGER_PROPERTY_X		0
+#define TASK_MANAGER_PROPERTY_Y 		45 
+
+#define _(string) (string)
+
+typedef struct _MokoTaskManager MokoTaskManager;
+
+struct _MokoTaskManager {
+    MokoApplication *app;
+    
+    MokoFingerWindow *window;//??
+    GtkWidget *gtk_window;//??
+    MokoFingerWheel *wheel;
+    MokoFingerToolBox *toolbox;
+    MokoTaskList *l;
+    
+    MokoPixmapButton *go_to;
+    MokoPixmapButton *kill;
+    MokoPixmapButton *kill_all;
+    MokoPixmapButton *quit;
+
+    };
+ 
+#endif /*taskmanager.h*/

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,66 +1,66 @@
-/**
- *  xatoms.c
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
- #include "xatoms.h"
-
- gboolean g_Atom_initialized = FALSE;
-
- char* atom_names[] = {
- 	"WM_PROTOCOLS",
-     	"_NET_WM_PING",
-  	"WM_DELETE_WINDOW",
-	"_NET_CLIENT_LIST",
-	"_NET_CLIENT_LIST_STACKING",
-   	"_NET_ACTIVE_WINDOW",
-   	"WM_STATE",
-    	"_NET_WM_WINDOW_TYPE",
-    	"_NET_WM_WINDOW_TYPE_DESKTOP",
-    	"_NET_WM_WINDOW_TYPE_DOCK",
-    	"_NET_WM_WINDOW_TYPE_NORMAL",
-    	"_NET_WM_WINDOW_TYPE_TOPLEVEL",
-    	"_NET_WM_NAME",
-    	"_NET_WM_ICON",
-    	"_NET_WM_ID",
-    	"_NET_STARTUP_ID",
-    	"_NET_CLIENT_ID",
-    	"_MB_CURRENT_APP_WINDOW",
-    	"_MB_COMMAND",
-    	"UTF8_STRING",
-};
-
-/**
-*@brief initialize openmoko footer dbus connection.
-*@param dpy		Display *
-*@return Bool
-*/
-gboolean 
-moko_initialize_X_atoms(const Display* dpy) {
-    if (g_Atom_initialized == TRUE)
-        return TRUE;
-    if (dpy ==NULL)
-    	 return FALSE;
-    
-    if (XInternAtoms (dpy, atom_names, (sizeof (atom_names) / sizeof (atom_names[0])), False, atoms)
-		!= Success)
-        return FALSE;
-    
-    g_Atom_initialized = TRUE;
-    return TRUE;
-    }
-
+/**
+ *  xatoms.c
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+ #include "xatoms.h"
+
+ gboolean g_Atom_initialized = FALSE;
+
+ char* atom_names[] = {
+ 	"WM_PROTOCOLS",
+     	"_NET_WM_PING",
+  	"WM_DELETE_WINDOW",
+	"_NET_CLIENT_LIST",
+	"_NET_CLIENT_LIST_STACKING",
+   	"_NET_ACTIVE_WINDOW",
+   	"WM_STATE",
+    	"_NET_WM_WINDOW_TYPE",
+    	"_NET_WM_WINDOW_TYPE_DESKTOP",
+    	"_NET_WM_WINDOW_TYPE_DOCK",
+    	"_NET_WM_WINDOW_TYPE_NORMAL",
+    	"_NET_WM_WINDOW_TYPE_TOPLEVEL",
+    	"_NET_WM_NAME",
+    	"_NET_WM_ICON",
+    	"_NET_WM_ID",
+    	"_NET_STARTUP_ID",
+    	"_NET_CLIENT_ID",
+    	"_MB_CURRENT_APP_WINDOW",
+    	"_MB_COMMAND",
+    	"UTF8_STRING",
+};
+
+/**
+*@brief initialize openmoko footer dbus connection.
+*@param dpy		Display *
+*@return Bool
+*/
+gboolean 
+moko_initialize_X_atoms(const Display* dpy) {
+    if (g_Atom_initialized == TRUE)
+        return TRUE;
+    if (dpy ==NULL)
+    	 return FALSE;
+    
+    if (XInternAtoms (dpy, atom_names, (sizeof (atom_names) / sizeof (atom_names[0])), False, atoms)
+		!= Success)
+        return FALSE;
+    
+    g_Atom_initialized = TRUE;
+    return TRUE;
+    }
+

Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h	2007-03-16 02:49:30 UTC (rev 1381)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h	2007-03-16 03:24:40 UTC (rev 1382)
@@ -1,56 +1,56 @@
-/**
- *  xatoms.h
- *
- *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2 of the license.
- *
- *  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 Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _TASK_MANAGER_X_ATOMS_H
-#define _TASK_MANAGER_X_ATOMS_H
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <gdk/gdk.h>
-
-enum {
-	WM_PROTOCOLS,
-	_NET_WM_PING,
-	WM_DELETE_WINDOW,
-	_NET_CLIENT_LIST,
-	_NET_CLIENT_LIST_STACKING,
-	_NET_ACTIVE_WINDOW,
-	WM_STATE,
-	_NET_WM_WINDOW_TYPE,
-	_NET_WM_WINDOW_TYPE_DESKTOP,
-	_NET_WM_WINDOW_TYPE_DOCK,
-	_NET_WM_WINDOW_TYPE_NORMAL,
-	_NET_WM_WINDOW_TYPE_TOPLEVEL,
-	_NET_WM_NAME,
-	_NET_WM_ICON,
-	_NET_WM_ID,
-	WM_CLIENT_LEADER,
-	_NET_CLIENT_ID,
-	_MB_CURRENT_APP_WINDOW,
-	_MB_COMMAND,
-	UTF8_STRING,
-	MAX_ATOM_NO
-};
-
-Atom atoms[MAX_ATOM_NO];
-
-gboolean 
-moko_initialize_X_atoms(const Display* dpy);
-
-#endif /*_TASK_MANAGER_X_ATOMS_H*/
+/**
+ *  xatoms.h
+ *
+ *  Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _TASK_MANAGER_X_ATOMS_H
+#define _TASK_MANAGER_X_ATOMS_H
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <gdk/gdk.h>
+
+enum {
+	WM_PROTOCOLS,
+	_NET_WM_PING,
+	WM_DELETE_WINDOW,
+	_NET_CLIENT_LIST,
+	_NET_CLIENT_LIST_STACKING,
+	_NET_ACTIVE_WINDOW,
+	WM_STATE,
+	_NET_WM_WINDOW_TYPE,
+	_NET_WM_WINDOW_TYPE_DESKTOP,
+	_NET_WM_WINDOW_TYPE_DOCK,
+	_NET_WM_WINDOW_TYPE_NORMAL,
+	_NET_WM_WINDOW_TYPE_TOPLEVEL,
+	_NET_WM_NAME,
+	_NET_WM_ICON,
+	_NET_WM_ID,
+	WM_CLIENT_LEADER,
+	_NET_CLIENT_ID,
+	_MB_CURRENT_APP_WINDOW,
+	_MB_COMMAND,
+	UTF8_STRING,
+	MAX_ATOM_NO
+};
+
+Atom atoms[MAX_ATOM_NO];
+
+gboolean 
+moko_initialize_X_atoms(const Display* dpy);
+
+#endif /*_TASK_MANAGER_X_ATOMS_H*/





More information about the commitlog mailing list