r327 - in trunk/src/target/OM-2007/applications/openmoko-taskmanager: . patch src
tongsong_li at gta01.hmw-consulting.de
tongsong_li at gta01.hmw-consulting.de
Thu Dec 7 04:15:56 CET 2006
Author: tongsong_li
Date: 2006-12-07 03:15:16 +0000 (Thu, 07 Dec 2006)
New Revision: 327
Added:
trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/
trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/README
trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/autopatch.sh
trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/matchbox-window-manager-1.0.patch
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/Makefile.am
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:
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/README
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/README 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/README 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,3 @@
+copy matchbox-window-manager-1.0.patch and autopatch.sh to matchbox-widnow-manager-1.0 folder, and then run autopatch.sh
+
+after install the patch reinstall matchbox-window-manager-1.0
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/README
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/autopatch.sh
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/autopatch.sh 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/autopatch.sh 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+patch -p2 --r <matchbox-window-manager-1.0.patch
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/autopatch.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/matchbox-window-manager-1.0.patch
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/matchbox-window-manager-1.0.patch 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/matchbox-window-manager-1.0.patch 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,44 @@
+diff -ruNw matchbox-window-manager-1.0/src/structs.h source/matchbox-window-manager-1.0/src/structs.h
+--- matchbox-window-manager-1.0/src/structs.h 2006-11-17 16:15:09.000000000 -0500
++++ source/matchbox-window-manager-1.0/src/structs.h 2006-02-19 16:00:52.000000000 -0500
+@@ -146,12 +146,6 @@
+ #define MB_CMD_COMPOSITE 8
+ #define MB_CMB_KEYS_RELOAD 9
+
+-/* Defines for MB_COMMAND values, for openmoko project */
+-#define MB_CMD_ACTIVAE_CLIENT 100
+-#define MB_CMD_REMOVE_CLIENT 101
+-#define MB_CMD_REMOVE_AND_ACTIVE 102
+-
+-
+ /* Atoms, if you change these check ewmh_init() first */
+
+ enum {
+diff -ruNw matchbox-window-manager-1.0/src/wm.c source/matchbox-window-manager-1.0/src/wm.c
+--- matchbox-window-manager-1.0/src/wm.c 2006-11-17 16:14:04.000000000 -0500
++++ source/matchbox-window-manager-1.0/src/wm.c 2006-02-19 17:44:18.000000000 -0500
+@@ -1625,24 +1625,6 @@
+ case MB_CMD_DESKTOP :
+ wm_toggle_desktop(w);
+ break;
+-/*For OpenMoko project, add by Sun Zhiyong*/
+- case MB_CMD_ACTIVAE_CLIENT :
+- if (w->focused_client == c)
+- break;
+- else
+- wm_activate_client(c);
+- break;
+- case MB_CMD_REMOVE_CLIENT :
+- wm_remove_client(w, c);
+- break;
+- case MB_CMD_REMOVE_AND_ACTIVE :
+- if (c == w->focused_client)
+- break;
+- else
+- wm_remove_client(w, w->stack_top_app);
+- wm_activate_client(c);
+- break;
+-/*End ADD*/
+ case MB_CMD_MISC: /* This is used for random testing stuff */
+ /* comp_engine_deinit(w); */
+ #ifdef DEBUG
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/patch/matchbox-window-manager-1.0.patch
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/Makefile.am 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/Makefile.am 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,9 @@
+INCLUDES = -DPKGDATADIR=\"$(pkgdatadir)\" @OPENMOKO_CFLAGS@ -Wall -std=c99 -pedantic
+
+bin_PROGRAMS = openmoko-taskmanager
+
+openmoko_taskmanager_SOURCES = taskmanager.c list_view.c callbacks.c \
+ popupmenu.c misc.c xatoms.c
+
+openmoko_taskmanager_LDADD = @OPENMOKO_LIBS@
+
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/Makefile.am
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,210 @@
+/**
+ * @file callbacks.c
+ * @brief openmoko-taskmanager callbacks functions based on misc.c.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include "callbacks.h"
+
+void
+om_update_store_list (Display *dpy, GtkListStore *list_store);
+
+void
+om_set_list_highlight (Display *dpy, List *l);
+
+GdkFilterReturn
+om_window_filter (GdkXEvent *xev, GdkEvent *gev, List *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]) {
+ om_update_store_list(dpy, l->list_store);
+ }
+ else if (ev->xproperty.atom == atoms[_NET_ACTIVE_WINDOW]) {
+ om_set_list_highlight (dpy, l);
+ }
+ }
+ return GDK_FILTER_CONTINUE;
+}
+
+gboolean
+om_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, 1, &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");
+ }
+ }
+
+
+gboolean
+om_cursor_changed(GtkTreeView *treeview, GtkTreeModel *model) {
+ g_debug ("Tab event");
+ }
+
+void
+om_add_window (Display *dpy, Window w, GtkListStore *list_store){
+ GtkTreeIter iter;
+ gchar *name = NULL;
+ GdkPixbuf *icon = NULL;
+ Atom type;
+
+ icon = om_get_window_icon (dpy, w);
+ //name = om_get_window_name(dpy, w);
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, 0, name, 1, w, -1);
+ //gtk_list_store_set (list_store, &iter, 1, w, -1);
+
+ if (icon) {
+ GdkPixbuf *icons = gdk_pixbuf_scale_simple (icon, 160, 160, GDK_INTERP_BILINEAR);
+ gdk_pixbuf_unref (icon);
+ gtk_list_store_set (list_store, &iter, 2, icons, -1);
+ }
+ /*FIXME if no icon there should be a default icon to be added*/
+ /*else {
+ GtkWidget *def_icon = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ GdkPixbuf *icons = gdk_pixbuf_scale_simple (def_icon, 160, 160, GDK_INTERP_BILINEAR);
+ gdk_pixbuf_unref (def_icon);
+ gtk_list_store_set (list_store, &iter, 2, icons, -1);
+ }
+ */
+ }
+
+void
+om_update_store_list (Display *dpy, GtkListStore *list_store) {
+ Window *list;
+ guint nr, i;
+ GtkTreeIter iter;
+ char *p;
+
+ if (om_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, 1, &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)
+ om_add_window (dpy, list[i], list_store);
+ }
+
+ g_free (p);
+}
+
+
+void
+om_set_list_highlight (Display *dpy, List *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, 1, &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->mokolist_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);
+ }
+ }
+ }
+
+void
+om_tab_event_cb (GtkButton *btn, List *l) {
+ g_debug ("tab event");
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeViewColumn *col;
+ GtkTreeModel *model;
+
+ //gtk_tree_view_get_cursor(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, 1, &w, -1);
+ //om_print_win_list(GDK_DISPLAY(), &w, 1);
+ //om_send_Xclimsgwm(GDK_DISPLAY (), w);
+ mbcommand(GDK_DISPLAY(), MB_CMD_ACTIVAE_CLIENT, w, NULL);
+ }
+ if (path)
+ free (path);
+ }
+
+void
+om_hold_event_cb (GtkButton *btn, List *l) {
+ g_debug ("tab with hold event");
+ om_init_popup_menu(NULL, NULL, l);
+ }
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,52 @@
+/**
+ * @file callbacks.h
+ * @brief openmoko-taskmanager callbacks based on misc.c.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+#ifndef _TASK_MANAGER_CALLBACKS_H
+#define _TASK_MANAGER_CALLBACKS_H
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <X11/Xlib.h>
+
+#include "misc.h"
+#include "list_view.h"
+#include "xatoms.h"
+#include "popupmenu.h"
+
+GdkFilterReturn
+om_window_filter (GdkXEvent *xev, GdkEvent *gev, List *l);
+
+void
+om_activate_task (GtkWidget *w, GtkWidget *list_view);
+
+gboolean
+om_kill_task (GtkWidget *w, GtkWidget *list_view);
+
+void
+om_row_activated (GtkTreeView *treeview, GtkTreePath *path,
+ GtkTreeViewColumn *col, GtkTreeModel *model);
+
+gboolean
+om_cursor_changed(GtkTreeView *treeview, GtkTreeModel *model);
+
+void
+om_tab_event_cb (GtkButton *btn, List *l);
+
+void
+om_hold_event_cb (GtkButton *btn, List *l);
+
+#endif /*callbacks.h*/
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.h
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,148 @@
+/**
+ * @file list_view.c
+ * @brief list_view.c based on misc.c and gtk+-2.0.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+ #include "list_view.h"
+
+ enum {
+ LIST_SIGNAL,
+ LAST_SIGNAL
+};
+
+static void list_class_init (ListClass *klass);
+static void list_init (List *l);
+
+static guint list_signals[LAST_SIGNAL] = { 0 };
+
+/**
+*@brief retrun List type.
+*@param none
+*@return GType
+*/
+GType list_get_type (void) /* Typechecking */
+{
+ static GType list_type = 0;
+
+ if (!list_type)
+ {
+ static const GTypeInfo list_info =
+ {
+ sizeof (ListClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) list_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (List),
+ 0,
+ (GInstanceInitFunc) list_init,
+ NULL
+ };
+
+ list_type = g_type_register_static (GTK_TYPE_VBOX, "List", &list_info, 0);
+ }
+
+ return list_type;
+}
+
+/**
+*@brief initialize List class.
+*@param klass List Class
+*@return none
+*/
+static void list_class_init(ListClass * 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 (ListClass, list),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+/**
+*@brief initialize List UI.
+*@param l List instance
+*@return none
+*/
+static void /* Instance Construction */
+list_init (List *l) {
+ GtkWidget *ico;
+ l->list_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_OBJECT);
+ //l->list_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (l->list_store));
+ 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);
+ // */
+ moko_tree_view_append_column (GTK_TREE_VIEW (l->mokolist_view), l->column);
+
+ /*l->scrolled = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (l->scrolled),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (l->scrolled), l->list_view);
+ */
+ l->scrolled = moko_tree_view_put_into_scrolled_window (l->mokolist_view);
+
+ l->btn_close = gtk_button_new ();
+ ico = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_show (ico);
+ gtk_container_add(GTK_CONTAINER(l->btn_close), ico);
+ gtk_widget_show (l->btn_close);
+
+ l->hbox = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (l->hbox);
+
+ 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_end (GTK_BOX (l), l->scrolled, TRUE, TRUE, 0);
+
+/*delete later*/
+ l->tab = gtk_button_new_with_label ("tab");
+ l->tabhold = gtk_button_new_with_label ("tab with hold");
+ gtk_widget_show (l->tab);
+ gtk_widget_show (l->tabhold);
+ gtk_box_pack_start (GTK_BOX (l), l->tab, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (l), l->tabhold, FALSE, FALSE, 0);
+/*end deleter later*/
+}
+
+/* Construction */
+GtkWidget*
+list_new() {
+ return GTK_WIDGET(g_object_new(list_get_type(), NULL));
+}
+
+/* Destruction */
+void
+list_clear(List *l) {
+ if (!l) g_free (l);
+}
+
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,71 @@
+/**
+ * @file list_view.h
+ * @brief list_view.h based on gtk+-2.0.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+ #ifndef OPENMOKO_LIST_VIEW_H
+ #define OPENMOKO_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"
+
+G_BEGIN_DECLS
+/*LIST property*/
+
+/*Pango Font spec*/
+
+#define LIST_TYPE (list_get_type())
+#define LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIST_TYPE, List))
+#define LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIST_TYPE, ListClass))
+#define IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIST_TYPE))
+#define IS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIST_TYPE))
+
+typedef struct _List List;
+typedef struct _ListClass ListClass;
+
+struct _List
+{
+ GtkVBox vbox;
+
+ GtkHBox *hbox;
+ GtkButton *btn_close;
+ GtkListStore *list_store;
+ //GtkWidget *list_view;
+ GtkWidget *scrolled;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ MokoTreeView *mokolist_view;
+
+ /*temporary */
+ GtkButton *tab, *tabhold;
+};
+
+struct _ListClass
+{
+ GtkVBoxClass parent_class;
+ void(*list) (List *l);
+};
+
+GType list_get_type (void);
+
+G_END_DECLS
+ #endif /*list_view.h*/
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,370 @@
+/**
+ * @file misc.c
+ * @brief misc.c based on Xlib glib and gtk+-2.0.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include "misc.h"
+
+gboolean
+om_X_ev_init (Display *dpy, GtkWidget *gtkwidget) {
+ if (my_win == None)
+ my_win = GDK_WINDOW_XWINDOW (gtkwidget);
+ if (!om_initialize_X_atoms(dpy))
+ return FALSE;
+ return TRUE;
+ }
+
+gboolean
+om_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;
+
+ om_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;
+ //om_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);
+ //om_print_win_list(dpy, temp_list, nitems);
+ /*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 = om_get_window_property (dpy, temp_list[i], atoms[_NET_WM_WINDOW_TYPE]);
+ /*XGetWindowProperty (dpy, temp_list[i], atoms[_NET_WM_WINDOW_TYPE], //need learn more about the func.
+ 0, G_MAXLONG, False, XA_ATOM, &actual_type, &actual_format,
+ &nitems, &bytes_after, &type);
+ */
+ if (type != atoms[_NET_WM_WINDOW_TYPE_DOCK] && type != atoms[_NET_WM_WINDOW_TYPE_DESKTOP]) {
+ 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
+om_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 *
+om_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 *
+om_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
+om_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 = om_get_window_name(dpy, win_list[i]);
+ g_debug ("%d. %s ", i, winname);
+ }
+ }
+
+Atom
+om_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
+om_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
+om_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);
+ }
+ }
+
+ 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);
+ }
+
+
+gboolean
+om_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;
+ }
+
+gboolean
+om_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
+om_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 om_send_delete_message (dpy, w);
+ }
+ return om_really_kill_client (dpy, w);
+ }
+/*void
+om_update_wlist(Display *dpy, Window **list, guint *amount)
+{
+ Window *new_list;
+ guint new_amount;
+ int i,j;
+
+ om_update_net_undocked_client_list(dpy, &new_list, &new_amount);
+
+ om_print_win_list(dpy, new_list, new_amount);
+
+ for (i=0; i<new_amount; i++)
+ {
+ for(j=0; j<amount && list[j] != new_list[i], j++)
+ {
+ list[i]
+ }
+ }
+
+}*/
+
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.c
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,91 @@
+/**
+ * @file misc.h
+ * @brief misc.h based on Xlib glib and gtk+-2.0.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+#ifndef _MISC_H
+#define _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_ACTIVAE_CLIENT 100
+#define MB_CMD_REMOVE_CLIENT 101
+#define MB_CMD_REMOVE_AND_ACTIVE 102
+
+Window my_win;
+
+
+gboolean
+om_X_ev_init (Display *dpy,GtkWidget *gtkwidget);
+
+gboolean
+om_update_net_undocked_client_list (Display* dpy, Window** list, guint* nr);
+
+GdkPixbuf *
+om_get_window_icon (Display *dpy, Window w);
+
+gchar *
+om_get_window_name (Display *dpy, Window w);
+
+void
+om_print_win_list (Display* dpy, Window* win_list, guint win_num);
+
+Atom
+om_get_window_property (Display *dpy, Window w, Atom property);
+
+gboolean
+om_get_current_active_client (Display* dpy, Window* window_return);
+
+void
+mbcommand(Display *dpy, int cmd_id, Window win, char *data);
+
+gboolean
+om_active_next_client (Display* dpy);
+
+gboolean
+om_kill_window (Display *dpy, Window w);
+
+/********/
+// the functions below have not implemented.
+gboolean
+om_set_atoms_name(const char** src_name, int src_num);
+
+
+#endif/*misc.h*/
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/misc.h
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,64 @@
+/**
+ * @file popupmen.c
+ * @brief popupmenu based on gtk and gdk.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include "popupmenu.h"
+
+void
+om_kill_task_cb(GtkMenuItem *item, List *l) {
+ g_debug ("kill task cb");
+ om_wm_cmd(item, l->mokolist_view, MB_CMD_REMOVE_CLIENT);
+ }
+
+void
+om_kill_and_swith_cb(GtkMenuItem *item, List *l) {
+ g_debug ("call kill and switch task function");
+ om_wm_cmd(item, l->mokolist_view, MB_CMD_REMOVE_AND_ACTIVE);
+ }
+
+void
+om_init_popup_menu (GtkWidget *my_widget, GdkEventButton *event, List *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 (om_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 (om_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);
+ }
+
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.c
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,28 @@
+/**
+ * @file popupmenu.h
+ * @brief popup based on gtk gdk.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+#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"
+
+#endif
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/popupmenu.h
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,63 @@
+/**
+ * @file taskmanager.c
+ * @brief openmoko-taskmanager taskmanager.c based on callbacks.h and list_view.h.
+ * @brief UI of openmoko-taskmanager based on list_view.c
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include "taskmanager.h"
+
+int
+main (int argc, char** argv) {
+ GtkWidget *taskmanager; //main window
+ Display *dpy;
+ List *list;
+
+ list = g_malloc (sizeof (List));
+
+ gtk_init (&argc, &argv);
+ dpy = GDK_DISPLAY ();
+
+ taskmanager = gtk_window_new (GTK_WINDOW_POPUP);//It is a popup window
+ gtk_window_set_title (taskmanager, _("Task Manager"));
+ gtk_widget_set_uposition (taskmanager, TASK_MANAGER_PROPERTY_X, TASK_MANAGER_PROPERTY_Y);
+ gtk_window_set_default_size (taskmanager, TASK_MANAGER_PROPERTY_WIDTH, TASK_MANAGER_PROPERTY_HEIGHT);
+ gtk_widget_show (taskmanager);
+
+ list = LIST(list_new());
+ om_update_store_list(dpy, list->list_store);
+ om_set_list_highlight(dpy, list);
+ gtk_widget_show (list);
+
+ gtk_container_add (taskmanager, GTK_WIDGET (list));
+ //moko_finger_window_set_contents( window, GTK_WIDGET(list) );
+
+
+ g_signal_connect (list->btn_close, "clicked", gtk_main_quit, NULL);
+//g_signal_connect (G_OBJECT (list->list_view), "cursor-changed", G_CALLBACK (om_cursor_changed),
+// GTK_TREE_MODEL (list->list_store));
+ g_signal_connect (G_OBJECT (list->tab), "clicked", G_CALLBACK (om_tab_event_cb), list);
+ g_signal_connect (G_OBJECT (list->tabhold), "clicked", G_CALLBACK (om_hold_event_cb), list);
+
+ gdk_window_add_filter (NULL, om_window_filter, list);
+ XSelectInput (dpy, DefaultRootWindow (dpy), PropertyChangeMask);
+
+ gtk_widget_show_all (taskmanager);
+
+ gtk_main();
+
+ g_free (list);
+}
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,46 @@
+/**
+ * @file taskmanager.h
+ * @brief openmoko-taskmanager taskmanager.c based on callbacks.h and list_view.h.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#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 <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <X11/Xlib.h>
+
+#include "list_view.h"
+#include "callbacks.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)
+
+#endif /*taskmanager.h*/
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.h
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,66 @@
+/**
+ * @file xatoms.c
+ * @brief xatoms.c based on X11/Xlib.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+ #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
+om_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;
+ }
+
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.c
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h 2006-12-07 03:11:25 UTC (rev 326)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h 2006-12-07 03:15:16 UTC (rev 327)
@@ -0,0 +1,55 @@
+/**
+ * @file xatoms.h
+ * @brief xatoms based on X11/Xlib.
+ * @author Sun Zhiyong
+ * @date 2006-10
+ *
+ * Copyright (C) 2006 FIC-SH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+#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
+om_initialize_X_atoms(const Display* dpy);
+
+#endif /*xatoms.h*/
Property changes on: trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/xatoms.h
___________________________________________________________________
Name: svn:executable
+ *
More information about the commitlog
mailing list