Enlightenment CVS committal

Author  : atmosphere
Project : misc
Module  : engage

Dir     : misc/engage/src


Modified Files:
        dock.c icon.c window.c wm.c 


Log Message:
my local changes that have made it slightly more reliable, this breaks "open" windows 
being easily identifiable with arrows, we'll upgrade gentoo theme accordingly, less 
hardcoded appearance though
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/dock.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- dock.c      27 Apr 2004 08:29:33 -0000      1.3
+++ dock.c      6 May 2004 12:47:20 -0000       1.4
@@ -143,7 +143,7 @@
       od_icon_tt_hide(icon);
 
     {
-      Evas_Coord          w, h;
+      Evas_Coord      w, h;
 
       evas_object_geometry_get(icon->tt_txt, NULL, NULL, &w, &h);
       evas_object_move(icon->tt_txt, dock.x + relative_x - 0.5 * w,
@@ -310,6 +310,9 @@
 static int
 od_dock_icon_disappear(void *data)
 {
+  Evas_List      *item = NULL;
+  double          delta = 0.0, s = 0.0;
+  OD_Icon        *i = NULL;
   OD_Icon        *icon = (OD_Icon *) data;
 
   if (!(icon->state & OD_ICON_STATE_DISAPPEARING)) {
@@ -319,17 +322,17 @@
     icon->start_time = ecore_time_get();
   }
   need_redraw = true;
-  double          delta =
+  delta =
     icon->scale - (1.0 -
                    (ecore_time_get() -
                     icon->start_time) / options.icon_appear_duration);
   icon->scale -= delta;
   if (icon->scale > 0.0) {
-    double          s = 0.5 * delta * options.size;
-    Evas_List      *item = dock.icons;
+    s = 0.5 * delta * options.size;
+    item = dock.icons;
 
     while (item) {
-      OD_Icon        *i = (OD_Icon *) item->data;
+      i = (OD_Icon *) item->data;
 
       if (i->x < icon->x)
         i->x += s;
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/icon.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- icon.c      2 May 2004 22:47:14 -0000       1.26
+++ icon.c      6 May 2004 12:47:20 -0000       1.27
@@ -13,6 +13,7 @@
 #ifdef DMALLOC
 #include "dmalloc.h"
 #endif
+#include <assert.h>
 
 Evas_List      *icon_mappings = NULL;
 Evas_List      *icon_paths = NULL;
@@ -33,11 +34,14 @@
 OD_Icon        *
 od_icon_new_applnk(const char *command, const char *winclass)
 {
-  char           *name, *icon_name, *icon_path;
+  OD_Icon        *ret = NULL;
+  char           *name = NULL;
+  char           *icon_name = NULL;
+  char           *icon_path = NULL;
 
   od_icon_mapping_get(winclass, &name, &icon_name);
   icon_path = od_icon_path_get(icon_name);
-  OD_Icon        *ret = od_icon_new(winclass, name, icon_path);
+  ret = od_icon_new(winclass, name, icon_path);
 
 #if 0
   fprintf(stderr,
@@ -71,27 +75,34 @@
 OD_Icon        *
 od_icon_new_minwin(Ecore_X_Window win)
 {
-  char           *name, *icon_name;
-  char           *winclass = od_wm_get_winclass(win);
-  char           *title = od_wm_get_title(win);
+  OD_Icon        *ret = NULL;
+  char           *icon_path = NULL;
+  char           *name = NULL, *icon_name = NULL;
+  char           *winclass = NULL;
+  char           *title = NULL;
 
+  winclass = od_wm_get_winclass(win);
+  title = od_wm_get_title(win);
   od_icon_mapping_get(winclass, &name, &icon_name);
-  char           *icon_path = od_icon_path_get(icon_name);
-  OD_Icon        *ret;
+  icon_path = od_icon_path_get(icon_name);
 
-  ret = od_icon_new(winclass, title, icon_path);
+  if ((ret = od_icon_new(winclass, title, icon_path))) {
 #ifdef HAVE_IMLIB
-  if (options.grab_min_icons != 0)
-    od_icon_grab(ret, win);
+    if (options.grab_min_icons != 0)
+      od_icon_grab(ret, win);
 #endif
+    ret->type = minimised_window;
+    ret->data.minwin.window = win;
+  }
 #if 0
   fprintf(stderr, "new minwin: icon_path=\"%s\"\n", icon_path);
 #endif
-  ret->type = minimised_window;
-  ret->data.minwin.window = win;
-  free(winclass);
-  free(title);
-  free(icon_path);
+  if (winclass)
+    free(winclass);
+  if (title)
+    free(title);
+  if (icon_path)
+    free(icon_path);
   return ret;
 }
 
@@ -99,13 +110,14 @@
 void
 od_icon_grab(OD_Icon * icon, Ecore_X_Window win)
 {
-  XWMHints       *hints;
-  Imlib_Image     img;
-  Display        *dsp;
-  int             scr, x, y, w, h;
+  XWMHints       *hints = NULL;
+  Imlib_Image     img = NULL;
+  Display        *dsp = NULL;
+  int             scr = 0, x = 0, y = 0, w = 0, h = 0;
   Pixmap          pmap, mask;
   Evas_Object    *obj = NULL;
 
+  assert(icon);
   if (icon->pic && !strcmp(evas_object_type_get(icon->pic), "edje"))
     return;
 
@@ -150,7 +162,7 @@
   imlib_free_image();
 
 done:
-  return; // just fix compiler warnings - why do we have an empty done?
+  return;                       // just fix compiler warnings - why do we have an 
empty done?
 }
 #endif
 
@@ -176,7 +188,7 @@
 od_icon_new(const char *winclass, const char *name, const char *icon_file)
 {
   const char     *icon_part = NULL;
-  OD_Icon        *ret = (OD_Icon *) malloc(sizeof(OD_Icon));
+  OD_Icon        *ret = NULL;
   char            path[PATH_MAX];
 
   Evas_Object    *icon = NULL;
@@ -184,6 +196,11 @@
   Evas_Object    *tt_txt = NULL;
   Evas_Object    *tt_shd = NULL;
 
+  assert(winclass);
+  assert(name);
+  assert(icon_file);
+
+  ret = (OD_Icon *) malloc(sizeof(OD_Icon));
   memset(ret, 0, sizeof(OD_Icon));
   ret->name = strdup(name);
   icon = ret->icon = edje_object_add(evas);
@@ -283,18 +300,23 @@
 void
 od_icon_del(OD_Icon * icon)
 {
+  assert(icon);
   switch (icon->type) {
   case application_link:
+    assert(icon->data.applnk.command);
+    assert(icon->data.applnk.winclass);
     free(icon->data.applnk.command);
     free(icon->data.applnk.winclass);
     break;
   case docked_icon:
+    assert(icon->data.applnk.command);
     free(icon->data.dicon.command);
     break;
   case minimised_window:
     break;
   }
 
+  assert(icon->icon);
   evas_object_del(icon->icon);
   if (icon->pic)
     evas_object_del(icon->pic);
@@ -304,6 +326,7 @@
     evas_object_del(icon->tt_shd);
   if (icon->arrow)
     evas_object_del(icon->arrow);
+  assert(icon->name);
   free(icon->name);
   free(icon);
 }
@@ -311,6 +334,10 @@
 void
 od_icon_arrow_show(OD_Icon * icon)
 {
+  assert(icon);
+  assert(icon->icon);
+  edje_object_signal_emit(icon->icon, "engage,app,opened", "");
+#if 0
   if (icon->arrow)
     evas_object_show(icon->arrow);
   else {
@@ -339,13 +366,19 @@
     evas_object_show(icon->arrow);
     free(pattern);
   }
+#endif
 }
 
 void
 od_icon_arrow_hide(OD_Icon * icon)
 {
+  assert(icon);
+  assert(icon->icon);
+  edje_object_signal_emit(icon->icon, "engage,app,closed", "");
+#if 0
   if (icon->arrow)
     evas_object_hide(icon->arrow);
+#endif
 }
 
 void
@@ -400,14 +433,15 @@
         if (item->next->next) {
           *icon_name = (char *) item->next->next->data;
         } else {
-          fprintf(stderr, "corrupt icon mapping for %s (icon_name)\n",winclass);
+          fprintf(stderr, "corrupt icon mapping for %s (icon_name)\n",
+                  winclass);
         }
       } else {
         fprintf(stderr, "corrupt icon mapping for %s (name)\n", winclass);
       }
       return;
     }
-    item = item->next; 
+    item = item->next;
   }
   *name = strdup(winclass);
   *icon_name = strdup(winclass);
@@ -478,7 +512,9 @@
 {
   pid_t           pid;
   Evas_List      *l = NULL;
+  const char     *winclass = NULL;
   OD_Icon        *icon = NULL;
+  OD_Window      *win = NULL;
 
   if ((icon = (OD_Icon *) data)) {
     if (!strcmp(emission, "engage,app,open")) {
@@ -492,7 +528,14 @@
         break;
       }
     } else if (!strcmp(emission, "engage,app,close")) {
-      /* FIXME Useful ? */
+      if (icon->data.applnk.winclass) {
+        if ((winclass = icon->data.applnk.winclass)) {
+          win = od_wm_window_current_by_window_class_get(winclass);
+          ecore_x_window_prop_protocol_set(win->id,
+                                           ECORE_X_WM_PROTOCOL_DELETE_REQUEST,
+                                           1);
+        }
+      }
     }
     fprintf(stderr, "App got %s from %s\n", emission, icon->name);
   }
@@ -541,7 +584,9 @@
         break;
       }
     }
+#if 0
     fprintf(stderr, "Minimize got %s from %s\n", emission, icon->name);
+#endif
   }
 }
 static void
@@ -563,10 +608,8 @@
           win = (OD_Window *) l->data;
 
           if (win->minwin == icon || win->applnk == icon) {
-            if (od_wm_iconified(win->id)) {
-              od_wm_activate_window(win->id);
-              break;
-            }
+            od_wm_activate_window(win->id);
+            break;
           }
         }
         break;
@@ -616,6 +659,8 @@
         break;
       }
     }
+#if 0
     fprintf(stderr, "Raise got %s from %s\n", emission, icon->name);
+#endif
   }
 }
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/window.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- window.c    5 May 2004 06:54:36 -0000       1.13
+++ window.c    6 May 2004 12:47:20 -0000       1.14
@@ -63,7 +63,7 @@
     return;
   if (mouse_focus_timer)
     ecore_timer_del(mouse_focus_timer);
-  mouse_focus_timer = ecore_timer_add(0.5, od_window_hide_timer_cb, NULL);
+  mouse_focus_timer = ecore_timer_add(0.75, od_window_hide_timer_cb, NULL);
 }
 static void
 handle_mouse_in(Ecore_Evas * _ee)
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/wm.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- wm.c        2 May 2004 21:58:20 -0000       1.11
+++ wm.c        6 May 2004 12:47:20 -0000       1.12
@@ -29,6 +29,38 @@
 static bool     od_wm_ignored(Ecore_X_Window win);
 
 OD_Window      *
+od_wm_window_current_by_window_class_get(const char *name)
+{
+  Evas_List      *l = NULL;
+  Evas_List      *tmp = NULL;
+  OD_Window      *win = NULL;
+  OD_Window      *result = NULL;
+  OD_Window      *current = NULL;
+
+#if 0
+  printf("trying to find %s\n", name);
+#endif
+  if ((current = evas_hash_find(clients_current, name)) == NULL) {
+    for (l = clients; l; l = l->next) {
+      if ((win = l->data)) {
+        if (od_wm_iconified(win->id))
+          continue;
+        if (win->applnk && win->applnk->data.applnk.winclass) {
+          if (!strcmp(name, win->applnk->data.applnk.winclass)) {
+            result = win;
+#if 0
+            fprintf(stderr, "%s(%8x)\n", name, win->id);
+#endif
+            break;
+          }
+        }
+      }
+    }
+  }
+  return (result);
+}
+
+OD_Window      *
 od_wm_window_next_by_window_class_get(const char *name)
 {
   Evas_List      *l = NULL;
@@ -146,7 +178,7 @@
 char           *
 od_wm_get_winclass(Ecore_X_Window win)
 {
-  char           *ret, *dummy;
+  char           *ret = NULL, *dummy = NULL;
 
   ecore_x_window_prop_name_class_get(win, &dummy, &ret);
   free(dummy);
@@ -170,8 +202,8 @@
 bool
 od_wm_iconified(Ecore_X_Window window)
 {
-  int             size;
-  Atom           *atom;
+  int             size = 0;;
+  Atom           *atom = NULL;
 
   if (ecore_x_window_prop_property_get(window, ecore_x_atom_get("WM_STATE"),
                                        ecore_x_atom_get("WM_STATE"), 32,
@@ -197,26 +229,28 @@
     free(atom);
     return hidden && !shaded;
   }
-
   return false;                 // anything we've missed ???
-
 }
 
-int window_prop_change_cb(void *data, int type, void *event)
+int
+window_prop_change_cb(void *data, int type, void *event)
 {
-  Ecore_X_Event_Window_Property * ev = event;
-  if(ev->atom != ecore_x_atom_get("_NET_CLIENT_LIST")) return 1;
+  Ecore_X_Event_Window_Property *ev = event;
+
+  if (ev->atom != ecore_x_atom_get("_NET_CLIENT_LIST"))
+    return 1;
   od_sync_clients(NULL);
-  return 1; // carry on
+  return 1;                     // carry on
 }
 
 void
 od_dock_icons_update_begin()
 {
   od_sync_clients(NULL);
-  ecore_x_event_mask_set(DefaultRootWindow(ecore_x_display_get()), 
+  ecore_x_event_mask_set(DefaultRootWindow(ecore_x_display_get()),
                          PropertyChangeMask);
-  ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, window_prop_change_cb, NULL);
+  ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, window_prop_change_cb,
+                          NULL);
 }
 
 Evas_Bool
@@ -337,7 +371,8 @@
         od_dock_add_applnk(owd->applnk);
       }
       owd->applnk->data.applnk.count++;
-      od_icon_arrow_show(owd->applnk);
+      if (owd->applnk->data.applnk.count == 1)
+        od_icon_arrow_show(owd->applnk);
       if (od_wm_iconified(owd->id)) {
         owd->minwin = od_icon_new_minwin(owd->id);
         od_dock_add_minwin(owd->minwin);
@@ -365,7 +400,7 @@
 Ecore_X_Window *
 od_wm_get_clients(int *size)
 {
-  Ecore_X_Window *win_list;
+  Ecore_X_Window *win_list = NULL;
 
   if (!ecore_x_window_prop_property_get(0, ecore_x_atom_get("_NET_CLIENT_LIST"),
                                         XA_WINDOW, 32,




-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to