_NET_WM_ICON, isn't finished.
authorsebastid <sebastid>
Fri, 3 Jun 2005 06:43:23 +0000 (06:43 +0000)
committersebastid <sebastid@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 3 Jun 2005 06:43:23 +0000 (06:43 +0000)
SVN revision: 15079

netwm.txt
src/bin/e_border.c
src/bin/e_border.h
src/bin/e_hints.c
src/bin/e_icon.c
src/bin/e_icon.h
src/preload/e_hack.c

index fd4c7d4..f95dcd4 100644 (file)
--- a/netwm.txt
+++ b/netwm.txt
@@ -39,7 +39,7 @@ _NET_WM_ACTION_STICK                [ ]
 _NET_WM_ALLOWED_ACTIONS             [ ]
 _NET_WM_DESKTOP                     [?] /* Remove this property on unmap */
 _NET_WM_HANDLED_ICONS               [ ]
-_NET_WM_ICON                        [ ]
+_NET_WM_ICON                        [X]
 _NET_WM_ICON_GEOMETRY               [ ]
 _NET_WM_ICON_NAME                   [X]
 _NET_WM_MOVERESIZE                  [ ]
index aadeda7..d119c3c 100644 (file)
@@ -351,6 +351,10 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map)
                       bd->client.icccm.fetch.icon_name = 0;
                       bd->client.netwm.fetch.icon_name = 1;
                    }
+                 else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON)
+                   {
+                      bd->client.netwm.fetch.icon = 1;
+                   }
               }
             free(atoms);
          }
@@ -1426,6 +1430,10 @@ e_border_act_kill_begin(E_Border *bd)
    e_object_del(E_OBJECT(bd));
 }
 
+void e_border_icon_add(E_Border *bd, Evas *e)
+{
+}
+
 void
 e_border_button_bindings_ungrab_all(void)
 {
@@ -1930,6 +1938,13 @@ _e_border_cb_window_property(void *data, int ev_type, void *ev)
        bd->client.icccm.fetch.window_role = 1;
        bd->changed = 1;
      }
+   /*
+   else if (e->atom == ECORE_X_ATOM_NET_WM_ICON)
+     {
+       bd->client.netwm.fetch.icon = 1;
+       bd->changed = 1;
+     }
+   */
    return 1;
 }
 
@@ -2928,6 +2943,39 @@ _e_border_eval(E_Border *bd)
 
        bd->client.netwm.fetch.icon_name = 0;
      }
+   /*
+   if (bd->client.netwm.fetch.icon)
+     {
+       if (bd->client.netwm.icon.data) free(bd->client.netwm.icon.data);
+       if (!ecore_x_netwm_icon_get(bd->client.win,
+                                   &bd->client.netwm.icon.width, &bd->client.netwm.icon.height,
+                                   &bd->client.netwm.icon.data, &bd->client.netwm.icon.size))
+         printf("ERROR: Fetch icon from client\n");
+       else
+         {
+            if (bd->icon_object)
+              {
+                 evas_object_del(bd->icon_object);
+                 bd->icon_object = NULL;
+              }
+            bd->icon_object = e_icon_add(bd->bg_evas);
+            e_icon_data_set(bd->icon_object, bd->client.netwm.icon.data,
+                            bd->client.netwm.icon.width, bd->client.netwm.icon.height);
+            e_icon_alpha_set(bd->icon_object, 1);
+
+            if (bd->bg_object)
+              {
+                 evas_object_show(bd->icon_object);
+                 edje_object_part_swallow(bd->bg_object, "icon_swallow", bd->icon_object);
+              }
+            else
+              {
+                 evas_object_hide(bd->icon_object);
+              }
+         }
+       bd->client.netwm.fetch.icon = 0;
+     }
+   */
    if (bd->client.icccm.fetch.machine)
      {
        if (bd->client.icccm.machine) free(bd->client.icccm.machine);
index 1e82c2e..af1ffff 100644 (file)
@@ -162,6 +162,12 @@ struct _E_Border
         unsigned int desktop;
         char *name;
         char *icon_name;
+        struct {
+             unsigned int *data;
+             int width;
+             int height;
+             int size;
+        } icon;
 
         /* NetWM Window state */
         struct {
@@ -181,6 +187,8 @@ struct _E_Border
         
         struct {
            unsigned char name : 1;
+           unsigned char icon_name : 1;
+           unsigned char icon : 1;
            /* No, fetch on new_client, shouldn't be changed after map.
            unsigned char pid : 1;
            */
@@ -190,7 +198,6 @@ struct _E_Border
            /* No, fetch on new_client, shouldn't be changed after map.
            unsigned char type : 1;
            */
-           unsigned char icon_name : 1;
            /* No, don't fetch state, update on client message
            unsigned char state : 1;
            */
@@ -401,6 +408,8 @@ EAPI void e_border_act_menu_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down
 EAPI void e_border_act_close_begin(E_Border *bd);
 EAPI void e_border_act_kill_begin(E_Border *bd);
 
+EAPI void e_border_icon_add(E_Border *bd, Evas *e);
+
 EAPI void e_border_button_bindings_ungrab_all(void);
 EAPI void e_border_button_bindings_grab_all(void);
     
index 6913c95..ad371d2 100644 (file)
@@ -51,7 +51,12 @@ e_hints_init(void)
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, 1);
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_VIRTUAL_ROOTS, 1);
 
+            ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_ICON, 1);
+
+            ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_ICON_NAME, 1);
+
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_NAME, 1);
+            ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_PID, 1);
 
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE, 1);
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE_STICKY, 1);
@@ -63,6 +68,9 @@ e_hints_init(void)
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE_ABOVE, 1);
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE_BELOW, 1);
 
+            ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, 1);
+            ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_VISIBLE_NAME, 1);
+
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_WINDOW_TYPE, 1);
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP, 1);
             ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK, 1);
index ef113a2..d731c3f 100644 (file)
@@ -82,6 +82,24 @@ e_icon_smooth_scale_get(Evas_Object *obj)
 }
 
 void
+e_icon_alpha_set(Evas_Object *obj, int alpha)
+{
+   E_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);   
+   evas_object_image_alpha_set(sd->obj, alpha);
+}
+
+int
+e_icon_alpha_get(Evas_Object *obj)
+{
+   E_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);   
+   return evas_object_image_alpha_get(sd->obj);
+}
+
+void
 e_icon_size_get(Evas_Object *obj, int *w, int *h)
 {
    E_Smart_Data *sd;
@@ -112,6 +130,16 @@ e_icon_fill_inside_set(Evas_Object *obj, int fill_inside)
    _e_icon_smart_reconfigure(sd);
 }
 
+void
+e_icon_data_set(Evas_Object *obj, void *data, int w, int h)
+{
+   E_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);
+   evas_object_image_size_set(sd->obj, w, h);
+   evas_object_image_data_copy_set(sd->obj, data);
+}
+
 /* local subsystem globals */
 static void
 _e_icon_smart_reconfigure(E_Smart_Data *sd)
index 11a45b7..c544bc7 100644 (file)
@@ -11,9 +11,12 @@ EAPI void         e_icon_file_set         (Evas_Object *obj, const char *file);
 EAPI const char  *e_icon_file_get         (Evas_Object *obj);
 EAPI void         e_icon_smooth_scale_set (Evas_Object *obj, int smooth);
 EAPI int          e_icon_smooth_scale_get (Evas_Object *obj);
+EAPI void         e_icon_alpha_set        (Evas_Object *obj, int smooth);
+EAPI int          e_icon_alpha_get        (Evas_Object *obj);
 EAPI void         e_icon_size_get         (Evas_Object *obj, int *w, int *h);
 EAPI int          e_icon_fill_inside_get  (Evas_Object *obj);
 EAPI void         e_icon_fill_inside_set  (Evas_Object *obj, int fill_inside);
+EAPI void         e_icon_data_set         (Evas_Object *obj, void *data, int w, int h);
 
 #endif
 #endif
index a21ed19..357df14 100644 (file)
@@ -35,7 +35,7 @@ __e_hack_set_properties(Display *display, Window window)
    if (!a_manager)      a_manager      = XInternAtom(display, "_E_HACK_MANAGER", False);
 
    if ((env = getenv("E_LAUNCH_ID")))
-      XChangeProperty(display, window, a_launch_id, XA_STRING, 8, PropModeReplace, env, strlen(env));
+      XChangeProperty(display, window, a_launch_id, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
      {
        uid_t uid;
        pid_t pid, ppid;
@@ -47,29 +47,29 @@ __e_hack_set_properties(Display *display, Window window)
        ppid = getppid();
 
        snprintf(buf, sizeof(buf), "%i", uid);
-       XChangeProperty(display, window, a_user_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf));
+       XChangeProperty(display, window, a_user_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
        snprintf(buf, sizeof(buf), "%i", pid);
-       XChangeProperty(display, window, a_process_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf));
+       XChangeProperty(display, window, a_process_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
        snprintf(buf, sizeof(buf), "%i", ppid);
-       XChangeProperty(display, window, a_p_process_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf));
+       XChangeProperty(display, window, a_p_process_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
        if (!uname(&ubuf))
          {
             snprintf(buf, sizeof(buf), "%s", ubuf.nodename);
-            XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, buf, strlen(buf));
+            XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
          }
        else
-          XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, " ", 1);
+          XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, (unsigned char *)" ", 1);
      }
    if ((env = getenv("USER")))
-      XChangeProperty(display, window, a_user_name, XA_STRING, 8, PropModeReplace, env, strlen(env));
+      XChangeProperty(display, window, a_user_name, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
    if ((env = getenv("E_DESK")))
-      XChangeProperty(display, window, a_desk, XA_STRING, 8, PropModeReplace, env, strlen(env));
+      XChangeProperty(display, window, a_desk, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
    if ((env = getenv("E_ZONE")))
-      XChangeProperty(display, window, a_zone, XA_STRING, 8, PropModeReplace, env, strlen(env));
+      XChangeProperty(display, window, a_zone, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
    if ((env = getenv("E_CONTAINER")))
-      XChangeProperty(display, window, a_container, XA_STRING, 8, PropModeReplace, env, strlen(env));
+      XChangeProperty(display, window, a_container, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
    if ((env = getenv("E_MANAGER")))
-      XChangeProperty(display, window, a_manager, XA_STRING, 8, PropModeReplace, env, strlen(env));
+      XChangeProperty(display, window, a_manager, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
 }
 
 /* XCreateWindow intercept hack */