Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_apps.c e_apps.h e_border.c e_eapp_main.c e_int_menus.c 


Log Message:


also support matching window roles

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- e_apps.c    1 Jul 2005 04:09:28 -0000       1.54
+++ e_apps.c    1 Jul 2005 04:41:34 -0000       1.55
@@ -516,7 +516,7 @@
 }
 
 E_App *
-e_app_window_name_class_title_find(char *name, char *class, char *title)
+e_app_window_name_class_title_role_find(char *name, char *class, char *title, 
char *role)
 {
    Evas_List *l;
    
@@ -530,19 +530,22 @@
        
        a = l->data;
        ok = 0;
-       if ((a->win_name) || (a->win_class) || (a->win_title))
+       if ((a->win_name) || (a->win_class) || (a->win_title) || (a->win_role))
          {
             if ((!a->win_name) ||
-                ((a->win_name) && (name) && (!strcmp(a->win_name, name))))
+                ((a->win_name) && (name) && (e_util_glob_match(name, 
a->win_name))))
               ok++;
             if ((!a->win_class) ||
-                ((a->win_class) && (class) && (!strcmp(a->win_class, class))))
+                ((a->win_class) && (class) && (e_util_glob_match(class, 
a->win_class))))
               ok++;
             if ((!a->win_title) ||
                 ((a->win_title) && (title) && (e_util_glob_match(title, 
a->win_title))))
               ok++;
+            if ((!a->win_role) ||
+                ((a->win_role) && (role) && (e_util_glob_match(role, 
a->win_role))))
+              ok++;
          }
-       if (ok >= 3)
+       if (ok >= 4)
          {
             _e_apps_list = evas_list_remove_list(_e_apps_list, l);
             _e_apps_list = evas_list_prepend(_e_apps_list, a);
@@ -831,6 +834,15 @@
        a->win_title = str;
        free(v);
      }
+   v = eet_read(ef, "app/window/role", &size);
+   if (v)
+     {
+       str = malloc(size + 1);
+       memcpy(str, v, size);
+       str[size] = 0;
+       a->win_role = str;
+       free(v);
+     }
    v = eet_read(ef, "app/info/startup_notify", &size);
    if (v)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- e_apps.h    1 Jul 2005 04:09:29 -0000       1.15
+++ e_apps.h    1 Jul 2005 04:41:34 -0000       1.16
@@ -38,6 +38,7 @@
    char               *win_name; /* window name */
    char               *win_class; /* window class */
    char               *win_title; /* window title */
+   char               *win_role; /* window role */
    
    Evas_List          *subapps; /* if this a directory, a list of more E_App's 
*/
    
@@ -75,7 +76,7 @@
 EAPI void   e_app_change_callback_add(void (*func) (void *data, E_App *a, 
E_App_Change ch), void *data);
 EAPI void   e_app_change_callback_del(void (*func) (void *data, E_App *a, 
E_App_Change ch), void *data);
 
-EAPI E_App *e_app_window_name_class_title_find(char *name, char *class, char 
*title);
+EAPI E_App *e_app_window_name_class_title_role_find(char *name, char *class, 
char *title, char *role);
 EAPI E_App *e_app_file_find(char *file);
 EAPI E_App *e_app_name_find(char *name);
 EAPI E_App *e_app_generic_find(char *generic);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.297
retrieving revision 1.298
diff -u -3 -r1.297 -r1.298
--- e_border.c  1 Jul 2005 04:09:29 -0000       1.297
+++ e_border.c  1 Jul 2005 04:41:34 -0000       1.298
@@ -1723,9 +1723,10 @@
        
        if (bd->client.netwm.name) title = bd->client.netwm.name;
        else title = bd->client.icccm.title;
-       a = e_app_window_name_class_title_find(bd->client.icccm.name,
-                                              bd->client.icccm.class,
-                                              title);
+       a = e_app_window_name_class_title_role_find(bd->client.icccm.name,
+                                                   bd->client.icccm.class,
+                                                   title,
+                                                   
bd->client.icccm.window_role);
        if (a)
          {
             o = edje_object_add(evas);
@@ -4901,9 +4902,10 @@
        else title = bd->client.icccm.title;
        mi = e_menu_item_new(m);
        e_menu_item_separator_set(mi, 1);
-       a = e_app_window_name_class_title_find(bd->client.icccm.name,
-                                              bd->client.icccm.class,
-                                              title);
+       a = e_app_window_name_class_title_role_find(bd->client.icccm.name,
+                                                   bd->client.icccm.class,
+                                                   title,
+                                                   
bd->client.icccm.window_role);
        if (a)
          {
             mi = e_menu_item_new(m);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_eapp_main.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- e_eapp_main.c       1 Jul 2005 04:09:30 -0000       1.7
+++ e_eapp_main.c       1 Jul 2005 04:41:34 -0000       1.8
@@ -24,6 +24,7 @@
    int del_win_name = 0;
    int del_win_class = 0;
    int del_win_title = 0;
+   int del_win_role = 0;
    int del_startup_notify = 0;
    int del_wait_exit = 0;
    char *file = NULL;
@@ -34,6 +35,7 @@
    char *set_win_name = NULL;
    char *set_win_class = NULL;
    char *set_win_title = NULL;
+   char *set_win_role = NULL;
    int   set_startup_notify = -1;
    int   set_wait_exit = -1;
    
@@ -88,6 +90,12 @@
             set_win_title = argv[i];
              valid_args++;
          }
+       else if ((!strcmp(argv[i], "-set-win-role")) && (i < (argc - 1)))
+         {
+            i++;
+            set_win_role = argv[i];
+             valid_args++;
+         }
        else if ((!strcmp(argv[i], "-set-startup-notify")) && (i < (argc - 1)))
          {
             i++;
@@ -109,6 +117,7 @@
             del_win_name = 1;
             del_win_class = 1;
             del_win_title = 1;
+            del_win_role = 1;
             del_startup_notify = 1;
             del_wait_exit = 1;
              valid_args++;
@@ -148,6 +157,11 @@
             del_win_title = 1;
              valid_args++;
          }
+       else if ((!strcmp(argv[i], "-del-win-role")))
+         {
+            del_win_role = 1;
+             valid_args++;
+         }
        else if ((!strcmp(argv[i], "-del-startup-notify")))
          {
             del_startup_notify = 1;
@@ -215,6 +229,8 @@
      eet_write(ef, "app/window/class", set_win_class, strlen(set_win_class), 
0);
    if (set_win_title)
      eet_write(ef, "app/window/title", set_win_title, strlen(set_win_title), 
0);
+   if (set_win_role)
+     eet_write(ef, "app/window/role", set_win_role, strlen(set_win_role), 0);
    if (set_startup_notify >= 0)
      {
        unsigned char tmp[1];
@@ -279,6 +295,8 @@
      eet_delete(ef, "app/window/class");
    if (del_win_title)
      eet_delete(ef, "app/window/title");
+   if (del_win_role)
+     eet_delete(ef, "app/window/role");
    if (del_startup_notify)
      eet_delete(ef, "app/info/startup_notify");
    if (del_wait_exit)
@@ -299,9 +317,10 @@
          "  -set-generic GENERIC       Set the application generic name\n"
          "  -set-comment COMMENT       Set the application comment\n"
          "  -set-exe EXE               Set the application execute line\n"
-         "  -set-win-name WIN_NAME     Set the application window name\n"
-         "  -set-win-class WIN_CLASS   Set the application window class\n"
+         "  -set-win-name WIN_NAME     Set the application window name glob\n"
+         "  -set-win-class WIN_CLASS   Set the application window class glob\n"
          "  -set-win-title WIN_TITLE   Set the application window title glob\n"
+         "  -set-win-role WIN_ROLE     Set the application window role glob\n"
          "  -set-startup-notify [1/0]  Set the application startup notify 
flag\n"
          "  -set-wait-exit [1/0]       Set the application wait exit flag\n"
          "  -del-name                  Delete the application name\n"
@@ -311,6 +330,7 @@
          "  -del-win-name              Delete the application window name\n"
          "  -del-win-class             Delete the application window class\n"
          "  -del-win-title             Delete the application window title 
glob\n"
+         "  -del-win-role              Delete the application window role 
glob\n"
          "  -del-startup-notify        Delete the application startup notify 
flag\n"
          "  -del-wait-exit             Delete the application wait exit flag\n"
          );
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- e_int_menus.c       1 Jul 2005 04:09:30 -0000       1.75
+++ e_int_menus.c       1 Jul 2005 04:41:34 -0000       1.76
@@ -570,9 +570,10 @@
        e_object_breadcrumb_add(E_OBJECT(bd), "clients_menu");
        e_menu_item_callback_set(mi, _e_int_menus_clients_item_cb, bd);
        if (!bd->iconic) e_menu_item_toggle_set(mi, 1);
-       a = e_app_window_name_class_title_find(bd->client.icccm.name,
-                                              bd->client.icccm.class,
-                                              title);
+       a = e_app_window_name_class_title_role_find(bd->client.icccm.name,
+                                                   bd->client.icccm.class,
+                                                   title,
+                                                   
bd->client.icccm.window_role);
        if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
      }
    mi = e_menu_item_new(m);
@@ -826,9 +827,10 @@
        e_object_ref(E_OBJECT(bd));
        e_object_breadcrumb_add(E_OBJECT(bd), "lost_clients_menu");
        e_menu_item_callback_set(mi, _e_int_menus_lost_clients_item_cb, bd);
-       a = e_app_window_name_class_title_find(bd->client.icccm.name,
-                                              bd->client.icccm.class,
-                                              title);
+       a = e_app_window_name_class_title_role_find(bd->client.icccm.name,
+                                                   bd->client.icccm.class,
+                                                   title,
+                                                   
bd->client.icccm.window_role);
        if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
      }
    e_object_free_attach_func_set(E_OBJECT(m), 
_e_int_menus_lost_clients_free_hook);




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to