Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_border.c e_error.c 


Log Message:


error dialogs now resize to fit text...

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- e_border.c  4 Jan 2005 01:32:23 -0000       1.43
+++ e_border.c  5 Jan 2005 06:56:57 -0000       1.44
@@ -1246,6 +1246,37 @@
    
    ev = event;
    bd = data;
+#ifdef INOUTDEBUG   
+     {
+       time_t t;
+       char *ct;
+       
+       const char *modes[] = {   
+          "MODE_NORMAL",
+            "MODE_WHILE_GRABBED",
+            "MODE_GRAB",
+            "MODE_UNGRAB"
+       };
+       const char *details[] = {
+          "DETAIL_ANCESTOR",
+            "DETAIL_VIRTUAL",
+            "DETAIL_INFERIOR",
+            "DETAIL_NON_LINEAR",
+            "DETAIL_NON_LINEAR_VIRTUAL",
+            "DETAIL_POINTER",
+            "DETAIL_POINTER_ROOT",
+            "DETAIL_DETAIL_NONE"
+       };
+       t = time(NULL);
+       ct = ctime(&t);
+       ct[strlen(ct) - 1] = 0;
+       printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n",
+              ev->win, ev->event_win,
+              ct,
+              modes[ev->mode],
+              details[ev->detail]);
+     }
+#endif   
 //   if (ev->mode == ECORE_X_EVENT_MODE_GRAB) return 1;
 //   if (ev->mode == ECORE_X_EVENT_MODE_UNGRAB) return 1;
 //   if (ev->mode == ECORE_X_EVENT_MODE_WHILE_GRABBED) return 1;
@@ -1271,34 +1302,42 @@
 
    ev = event;
    bd = data;
-   /* FIXME: this would normally take focus away in pointer focus mode */
-//   if (ev->mode == ECORE_X_EVENT_MODE_UNGRAB) return 1;
-//   if (ev->mode == ECORE_X_EVENT_MODE_WHILE_GRABBED) return 1;
-   if (ev->event_win == bd->win)
+#ifdef INOUTDEBUG   
      {
+       time_t t;
+       char *ct;
+       
        const char *modes[] = {   
-          "ECORE_X_EVENT_MODE_NORMAL",
-            "ECORE_X_EVENT_MODE_WHILE_GRABBED",
-            "ECORE_X_EVENT_MODE_GRAB",
-            "ECORE_X_EVENT_MODE_UNGRAB"
+          "MODE_NORMAL",
+            "MODE_WHILE_GRABBED",
+            "MODE_GRAB",
+            "MODE_UNGRAB"
        };
        const char *details[] = {
-          "ECORE_X_EVENT_DETAIL_ANCESTOR",
-            "ECORE_X_EVENT_DETAIL_VIRTUAL",
-            "ECORE_X_EVENT_DETAIL_INFERIOR",
-            "ECORE_X_EVENT_DETAIL_NON_LINEAR",
-            "ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL",
-            "ECORE_X_EVENT_DETAIL_POINTER",
-            "ECORE_X_EVENT_DETAIL_POINTER_ROOT",
-            "ECORE_X_EVENT_DETAIL_DETAIL_NONE"
+          "DETAIL_ANCESTOR",
+            "DETAIL_VIRTUAL",
+            "DETAIL_INFERIOR",
+            "DETAIL_NON_LINEAR",
+            "DETAIL_NON_LINEAR_VIRTUAL",
+            "DETAIL_POINTER",
+            "DETAIL_POINTER_ROOT",
+            "DETAIL_DETAIL_NONE"
        };
-       
-       printf("OUT 0x%x [%s] md=%s dt=%s\n",
-              ev->win,
-              bd->client.icccm.title,
+       t = time(NULL);
+       ct = ctime(&t);
+       ct[strlen(ct) - 1] = 0;
+       printf("@@ <-OUT 0x%x 0x%x %s md=%s dt=%s\n",
+              ev->win, ev->event_win,
+              ct,
               modes[ev->mode],
               details[ev->detail]);
-
+     }
+#endif   
+   /* FIXME: this would normally take focus away in pointer focus mode */
+//   if (ev->mode == ECORE_X_EVENT_MODE_UNGRAB) return 1;
+//   if (ev->mode == ECORE_X_EVENT_MODE_WHILE_GRABBED) return 1;
+   if (ev->event_win == bd->win)
+     {
        if ((ev->mode == ECORE_X_EVENT_MODE_UNGRAB) &&
            (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
          return 1;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_error.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_error.c   25 Nov 2004 03:37:44 -0000      1.1
+++ e_error.c   5 Jan 2005 06:56:57 -0000       1.2
@@ -53,31 +53,18 @@
    Evas *e;
    int error_w, error_h;
    Evas_List *l, *shapelist = NULL;
+   Evas_Coord maxw, maxh;
    
    error_w = 400;
    error_h = 200;
    ee = ecore_evas_software_x11_new(NULL, man->win, 
                                    (man->w - error_w) / 2, (man->h - error_h) 
/ 2,
                                    error_w, error_h);
+   ecore_evas_software_x11_direct_resize_set(ee, 1);
    e_canvas_add(ee);
-   for (l = man->containers; l; l = l->next)
-     {
-       E_Container *con;
-       E_Container_Shape *es;
-       int x, y, w, h;
-       
-       con = l->data;
-       ecore_evas_geometry_get(ee, &x, &y, &w, &h);
-       es = e_container_shape_add(con);
-       e_container_shape_move(es, x, y);
-       e_container_shape_resize(es, w, h);
-       e_container_shape_show(es);
-       shapelist = evas_list_append(shapelist, es);
-     }
-   ecore_evas_data_set(ee, "shapes", shapelist);
+   
    ecore_evas_name_class_set(ee, "E", "Low_Level_Dialog");
    ecore_evas_title_set(ee, "Enlightenment: Low Level Dialog");
-   ecore_evas_show(ee);
    e = ecore_evas_get(ee);
    e_path_evas_append(path_fonts, e);
    e_pointer_ecore_evas_set(ee);
@@ -87,14 +74,8 @@
        Evas_Coord tw, th;
        char *newstr;
        
-       o = evas_object_image_add(e);
-       evas_object_image_file_set(o, e_path_find(path_images, "error_bg.png"), 
NULL);
-       evas_object_move(o, 0, 0);
-       evas_object_image_fill_set(o, 0, 0, error_w, error_h);
-       evas_object_resize(o, error_w, error_h);
-       evas_object_image_border_set(o, 3, 3, 3, 3);
-       evas_object_pass_events_set(o, 1);
-       evas_object_show(o);
+       maxw = 0;
+       maxh = 0;
        
        o = evas_object_image_add(e);
        evas_object_image_file_set(o, e_path_find(path_images, "e.png"), NULL);
@@ -110,10 +91,13 @@
        evas_object_text_text_set(o, title);
        evas_object_geometry_get(o, NULL, NULL, &tw, &th);
        evas_object_move(o, 
-                        (16 + 64 + 16 + (((400 - (16 + 64 + 16 + 16)) - tw) / 
2)) + 1,
+                        (16 + 64 + 16) + 1,
                         (16 + ((64 - th) / 2)) + 1);
        evas_object_pass_events_set(o, 1);
        evas_object_show(o);
+       
+       maxw = 16 + 64 + 16 + tw + 16;
+       maxh = 16 + 64;
 
        o = evas_object_text_add(e);
        evas_object_color_set(o, 0, 0, 0, 255);
@@ -121,7 +105,7 @@
        evas_object_text_text_set(o, title);
        evas_object_geometry_get(o, NULL, NULL, &tw, &th);
        evas_object_move(o, 
-                        16 + 64 + 16 + (((400 - (16 + 64 + 16 + 16)) - tw) / 
2), 
+                        16 + 64 + 16,
                         16 + ((64 - th) / 2));
        evas_object_pass_events_set(o, 1);
        evas_object_show(o);
@@ -156,13 +140,23 @@
                  evas_object_move(o, 16, y);
                  evas_object_pass_events_set(o, 1);
                  evas_object_show(o);
+                 
+                 if ((16 + tw + 16) > maxw) maxw = 16 + tw + 16;
                  y += th;
                  if (pp) p = pp + 1;
                  else p = NULL;
               }
             free(newstr);
+            maxh = y;
          }
        
+       maxh += 16 + 32 + 16;
+       error_w = maxw;
+       error_h = maxh;
+       
+       if (error_w > man->w) error_w = man->w;
+       if (error_h > man->h) error_h = man->h;
+       
        o = evas_object_image_add(e);
        evas_object_image_file_set(o, e_path_find(path_images, 
"button_out.png"), NULL);
        evas_object_move(o, (error_w - 64) / 2, error_h - 16 - 32);
@@ -190,10 +184,40 @@
        evas_object_move(o, (error_w - tw) / 2, error_h - 16 - 32 + ((32 - th) 
/ 2));
        evas_object_pass_events_set(o, 1);
        evas_object_show(o);
+
+       o = evas_object_image_add(e);
+       evas_object_image_file_set(o, e_path_find(path_images, "error_bg.png"), 
NULL);
+       evas_object_move(o, 0, 0);
+       evas_object_image_fill_set(o, 0, 0, error_w, error_h);
+       evas_object_resize(o, error_w, error_h);
+       evas_object_image_border_set(o, 3, 3, 3, 3);
+       evas_object_pass_events_set(o, 1);
+       evas_object_layer_set(o, -10);
+       evas_object_show(o);
+
+       ecore_evas_move(ee, (man->w - error_w) / 2, (man->h - error_h) / 2);
+       ecore_evas_resize(ee, error_w, error_h);
+       
+       for (l = man->containers; l; l = l->next)
+         {
+            E_Container *con;
+            E_Container_Shape *es;
+            int x, y, w, h;
+            
+            con = l->data;
+            ecore_evas_geometry_get(ee, &x, &y, &w, &h);
+            es = e_container_shape_add(con);
+            e_container_shape_move(es, x, y);
+            e_container_shape_resize(es, w, h);
+            e_container_shape_show(es);
+            shapelist = evas_list_append(shapelist, es);
+         }
+       ecore_evas_data_set(ee, "shapes", shapelist);
        
        o = evas_object_rectangle_add(e);
        evas_object_name_set(o, "allocated");
      }
+   ecore_evas_show(ee);
 }
 
 /* local subsystem functions */




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to